}
// Finally, round the size of the total struct up to the alignment
- // of the struct itself. Amazingly, this does not occur in the MS
- // ABI after virtual base layout.
- if (!isMicrosoftCXXABI() || RD->getNumVBases())
- FinishLayout(RD);
+ // of the struct itself.
+ FinishLayout(RD);
#ifndef NDEBUG
// Check that we have base offsets for all bases.
else
setSize(CharUnits::One());
}
+
+ // MSVC doesn't round up to the alignment of the record with virtual bases.
+ if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
+ if (isMicrosoftCXXABI() && RD->getNumVBases())
+ return;
+ }
+
// Finally, round the size of the record up to the alignment of the
// record itself.
uint64_t UnpaddedSize = getSizeInBits() - UnfilledBitsInLastByte;
int p;
};
+struct R {};
#pragma pack(pop)
N* n;
O* o;
P* p;
+ R* r;
return 0;
}
// CHECK-NEXT: nvsize=12, nvalign=4
//CHECK: %struct.P = type { %struct.M.base, i32, %struct.K, %struct.L }
+
+// CHECK: 0 | struct R (empty)
+// CHECK-NEXT: sizeof=1, dsize=0, align=1
+// CHECK-NEXT: nvsize=0, nvalign=1
+
+//CHECK: %struct.R = type { i8 }