| 1 |
// Red Hat bugzilla 65210 |
| 2 |
// { dg-do run } |
| 3 |
|
| 4 |
struct A { |
| 5 |
int a; |
| 6 |
}; |
| 7 |
|
| 8 |
struct B : public virtual A {}; |
| 9 |
|
| 10 |
struct C { |
| 11 |
long double c; |
| 12 |
}; |
| 13 |
|
| 14 |
struct D : public virtual C { |
| 15 |
int d; |
| 16 |
}; |
| 17 |
|
| 18 |
struct E : public B, public D { |
| 19 |
int e; |
| 20 |
}; |
| 21 |
|
| 22 |
E e; |
| 23 |
|
| 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. */ |
| 27 |
|
| 28 |
int main () |
| 29 |
{ |
| 30 |
D* dp = &e; |
| 31 |
unsigned long d_offset = ((char*)dp) - ((char*) &e); |
| 32 |
return (d_offset != sizeof(void *)); |
| 33 |
} |