2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / abi / layout2.C
blobfb4e1e5d9ff0b66d097f4da1b6c9b9c4e00dcc35
1 // Red Hat bugzilla 65210
2 // { dg-do run }
4 struct A {
5     int a;
6 };
8 struct B : public virtual A {};
10 struct C {
11   long double c;
14 struct D : public virtual C {
15     int d;
18 struct E : public B, public D {
19     int e;
22 E e;
24 /* The layout of E should begin with the B-in-E vtable pointer, followed by
25    the D-in-E vtable pointer.  The bug was that we used to pad out the D
26    fields for long double alignment.  */
28 int main ()
30   D* dp = &e;
31   unsigned long d_offset = ((char*)dp) - ((char*) &e);
32   return (d_offset != sizeof(void *));