2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.abi / empty.C
blob40aac9e9d071f695bbe1de161bd96a85ae81391b
1 // { dg-do run  }
2 // { dg-options "-w" }
3 // Origin: Mark Mitchell <mark@codesourcery.com>
5 #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
7 struct S0
9 };
11 struct S1 : public S0
15 struct S2 : public S1
17   char c;
20 // In S3, the S1 instance is allocated first at offset zero.  The S2
21 // instance has to be allocated at a subsequent offset; it's first
22 // part is also an S1.
24 struct S3 : public S1, public S2
28 struct S4 
30   int i;
33 // In S4, in contrast to S3, S2 is allocated first, and S1 can be
34 // allocated on top of S4.
36 struct S5 : public S2, public S1, public S4
40 // The T classes are by-hand layouts that should be equivalent to the
41 // S classes.
43 struct T3
45   S1 s1;
46   S2 s2;
49 struct T5
51   S2 s2;
52   S4 s4;
55 int main ()
57   if (sizeof (S3) != sizeof (T3))
58     return 1;
59   else if (sizeof (S5) != sizeof (T5))
60     return 2;
63 #else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
65 int main () 
69 #endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */