Consider: ---- struct A { virtual ~A(); }; // 4 struct B { virtual ~B(); }; // 4
struct X : virtual public A, virtual public B { // 8 }; struct Y : virtual public B { // 4 virtual ~Y(); }; struct Z : virtual public X, public Y { // 8 Z(); }; Z::Z() {} ---- In this example, the DECL_SIZE_UNIT of "Z" is 8 bytes. Here, the FIELD_DECL corresponding to it's Y superclass has an offset of 0 bytes and size 4 bytes. The FIELD_DECL for the X superclass has an offset of 4 bytes and and a size of 8 bytes, which means that the end of the object is 12 bytes, despite the fact that Z has a DECL_SIZE_UNIT of 8 bytes. -Chris -- Summary: Type layout bug Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sabre at nondot dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26426