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 6 extern "C" using at_exit_handler = void(); 7 8 int atexit(at_exit_handler handler) { return 0; } 9 10 struct TestVB { 11 static void operator delete(void *ptr, size_t sz) {} 12 virtual ~TestVB() {} 13 virtual void IntroFunction1() {} 14 int X; 15 } A; 16 17 struct TestNVB { 18 static void operator delete(void *ptr, size_t sz) {} 19 virtual ~TestNVB() {} 20 virtual void IntroFunction2() {} 21 int Y; 22 } B; 23 24 struct TestVBLayout 25 : public virtual TestVB, 26 public TestNVB { 27 static void operator delete(void *ptr, size_t sz) {} 28 int Z; 29 } C; 30 31 struct TestIVBBase : public virtual TestVB { 32 int A; 33 } D; 34 35 struct TestIVBDerived : public TestIVBBase { 36 int B; 37 } E; 38 39 struct TestIVBMergedDerived 40 : public virtual TestVB, 41 public TestIVBBase { 42 int B; 43 } F; 44 45 int main(int argc, char **argv) { 46 47 return 0; 48 } 49