UpdateEmptyClassOffsets(FD, Offset + FieldOffset);
}
+ const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
+
if (UpdateVBases) {
// FIXME: Update virtual bases.
+ } else if (PrimaryBase && Layout.getPrimaryBaseWasVirtual()) {
+ // We always want to update the offsets of a primary virtual base.
+ assert(Layout.getVBaseClassOffset(PrimaryBase) == 0 &&
+ "primary base class offset must always be 0!");
+ UpdateEmptyClassOffsets(PrimaryBase, Offset, /*UpdateVBases=*/false);
}
}
#define SA(n, p) int a##n[(p) ? 1 : -1]
+namespace Test0 {
+
struct A { int a; };
SA(0, sizeof(A) == 4);
struct S8 : Empty, A {
};
SA(12, sizeof(S8) == 4);
+
+}
+
+namespace Test1 {
+
+// Test that we don't try to place both A subobjects at offset 0.
+struct A { };
+class B { virtual void f(); };
+class C : A, virtual B { };
+struct D : virtual C { };
+struct E : virtual A { };
+class F : D, E { };
+
+SA(0, sizeof(F) == 24);
+
+}