* gdb.cp/class2.cc (empty): New class.

(refer): New function.
        (main): Declare an object of type empty and use it.
        * gdb.cp/class2.exp: Print the value of an object of type empty.
This commit is contained in:
Joel Brobecker
2004-02-26 20:22:44 +00:00
parent 9b50c11b36
commit 98f9cd2d31
3 changed files with 22 additions and 1 deletions

View File

@@ -48,10 +48,19 @@ void refer (A *)
;
}
struct empty {};
// Stop the compiler from optimizing away data.
void refer (empty *)
{
;
}
int main (void)
{
A alpha, *aap, *abp;
B beta, *bbp;
empty e;
alpha.a1 = 100;
beta.a1 = 200; beta.b1 = 201; beta.b2 = 202;
@@ -59,6 +68,7 @@ int main (void)
aap = α refer (aap);
abp = β refer (abp);
bbp = β refer (bbp);
refer (&e);
return 0; // marker return 0
} // marker close brace