49 lines · cpp
1// Compile with "cl /c /Zi /GR- ComplexPaddingTest.cpp"2// Link with "link ComplexPaddingTest.obj /debug /nodefaultlib /entry:main"3 4#include <stdint.h>5 6extern "C" using at_exit_handler = void();7 8int atexit(at_exit_handler handler) { return 0; }9 10struct TestVB {11 static void operator delete(void *ptr, size_t sz) {}12 virtual ~TestVB() {}13 virtual void IntroFunction1() {}14 int X;15} A;16 17struct TestNVB {18 static void operator delete(void *ptr, size_t sz) {}19 virtual ~TestNVB() {}20 virtual void IntroFunction2() {}21 int Y;22} B;23 24struct TestVBLayout25 : public virtual TestVB,26 public TestNVB {27 static void operator delete(void *ptr, size_t sz) {}28 int Z;29} C;30 31struct TestIVBBase : public virtual TestVB {32 int A;33} D;34 35struct TestIVBDerived : public TestIVBBase {36 int B;37} E;38 39struct TestIVBMergedDerived40 : public virtual TestVB,41 public TestIVBBase {42 int B;43} F;44 45int main(int argc, char **argv) {46 47 return 0;48}49