// Reserve space for this field.
uint64_t FieldSizeInBits = Context.toBits(FieldSize);
if (IsUnion)
- setSize(std::max(getSizeInBits(), FieldSizeInBits));
+ setDataSize(std::max(getDataSizeInBits(), FieldSizeInBits));
else
- setSize(FieldOffset + FieldSize);
+ setDataSize(FieldOffset + FieldSize);
- // Update the data size.
- setDataSize(getSizeInBits());
+ // Update the size.
+ setSize(std::max(getSizeInBits(), getDataSizeInBits()));
// Remember max struct/class alignment.
UpdateAlignment(FieldAlign, UnpackedFieldAlign);
SA(0, sizeof(B) == 16);
}
+
+namespace Test7 {
+ // Make sure we reserve enough space for both bases; PR11745.
+ struct Empty { };
+ struct Base1 : Empty { };
+ struct Base2 : Empty { };
+ struct Test : Base1, Base2 {
+ char c;
+ };
+ SA(0, sizeof(Test) == 2);
+}