xref: /minix3/external/bsd/llvm/dist/clang/test/Layout/ms-x86-basic-layout.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
2*f4a2713aSLionel Sambuc // RUN:            | FileCheck %s
3*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only -cxx-abi microsoft %s 2>/dev/null \
4*f4a2713aSLionel Sambuc // RUN:            | FileCheck %s -check-prefix CHECK-X64
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc extern "C" int printf(const char *fmt, ...);
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc struct A4 {
9*f4a2713aSLionel Sambuc 	int a;
10*f4a2713aSLionel Sambuc 	A4() : a(0xf00000a4) {}
11*f4a2713aSLionel Sambuc };
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc struct B4 {
14*f4a2713aSLionel Sambuc 	int a;
15*f4a2713aSLionel Sambuc 	B4() : a(0xf00000b4) {}
16*f4a2713aSLionel Sambuc };
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc struct C4 {
19*f4a2713aSLionel Sambuc 	int a;
20*f4a2713aSLionel Sambuc 	C4() : a(0xf00000c4) {}
21*f4a2713aSLionel Sambuc 	virtual void f() {printf("C4");}
22*f4a2713aSLionel Sambuc };
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc struct A16 {
25*f4a2713aSLionel Sambuc 	__declspec(align(16)) int a;
26*f4a2713aSLionel Sambuc 	A16() : a(0xf0000a16) {}
27*f4a2713aSLionel Sambuc };
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc struct C16 {
30*f4a2713aSLionel Sambuc 	__declspec(align(16)) int a;
31*f4a2713aSLionel Sambuc 	C16() : a(0xf0000c16) {}
32*f4a2713aSLionel Sambuc 	virtual void f() {printf("C16");}
33*f4a2713aSLionel Sambuc };
34*f4a2713aSLionel Sambuc 
35*f4a2713aSLionel Sambuc struct TestF0 : A4, virtual B4 {
36*f4a2713aSLionel Sambuc 	int a;
37*f4a2713aSLionel Sambuc 	TestF0() : a(0xf00000F0) {}
38*f4a2713aSLionel Sambuc };
39*f4a2713aSLionel Sambuc 
40*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
41*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF0
42*f4a2713aSLionel Sambuc // CHECK:    0 |   struct A4 (base)
43*f4a2713aSLionel Sambuc // CHECK:    0 |     int a
44*f4a2713aSLionel Sambuc // CHECK:    4 |   (TestF0 vbtable pointer)
45*f4a2713aSLionel Sambuc // CHECK:    8 |   int a
46*f4a2713aSLionel Sambuc // CHECK:   12 |   struct B4 (virtual base)
47*f4a2713aSLionel Sambuc // CHECK:   12 |     int a
48*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=16, align=4
49*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=12, nvalign=4]
50*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
51*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF0
52*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct A4 (base)
53*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     int a
54*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   (TestF0 vbtable pointer)
55*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   int a
56*f4a2713aSLionel Sambuc // CHECK-X64:   24 |   struct B4 (virtual base)
57*f4a2713aSLionel Sambuc // CHECK-X64:   24 |     int a
58*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=32, align=8
59*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=24, nvalign=8]
60*f4a2713aSLionel Sambuc 
61*f4a2713aSLionel Sambuc struct TestF1 : A4, virtual A16 {
62*f4a2713aSLionel Sambuc 	int a;
63*f4a2713aSLionel Sambuc 	TestF1() : a(0xf00000f1) {}
64*f4a2713aSLionel Sambuc };
65*f4a2713aSLionel Sambuc 
66*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
67*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF1
68*f4a2713aSLionel Sambuc // CHECK:    0 |   struct A4 (base)
69*f4a2713aSLionel Sambuc // CHECK:    0 |     int a
70*f4a2713aSLionel Sambuc // CHECK:    4 |   (TestF1 vbtable pointer)
71*f4a2713aSLionel Sambuc // CHECK:    8 |   int a
72*f4a2713aSLionel Sambuc // CHECK:   16 |   struct A16 (virtual base)
73*f4a2713aSLionel Sambuc // CHECK:   16 |     int a
74*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=32, align=16
75*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=12, nvalign=4]
76*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
77*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF1
78*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct A4 (base)
79*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     int a
80*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   (TestF1 vbtable pointer)
81*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   int a
82*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   struct A16 (virtual base)
83*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     int a
84*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=48, align=16
85*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=24, nvalign=8]
86*f4a2713aSLionel Sambuc 
87*f4a2713aSLionel Sambuc struct TestF2 : A4, virtual C4 {
88*f4a2713aSLionel Sambuc 	int a;
89*f4a2713aSLionel Sambuc 	TestF2() : a(0xf00000f2) {}
90*f4a2713aSLionel Sambuc };
91*f4a2713aSLionel Sambuc 
92*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
93*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF2
94*f4a2713aSLionel Sambuc // CHECK:    0 |   struct A4 (base)
95*f4a2713aSLionel Sambuc // CHECK:    0 |     int a
96*f4a2713aSLionel Sambuc // CHECK:    4 |   (TestF2 vbtable pointer)
97*f4a2713aSLionel Sambuc // CHECK:    8 |   int a
98*f4a2713aSLionel Sambuc // CHECK:   12 |   struct C4 (virtual base)
99*f4a2713aSLionel Sambuc // CHECK:   12 |     (C4 vftable pointer)
100*f4a2713aSLionel Sambuc // CHECK:   16 |     int a
101*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=20, align=4
102*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=12, nvalign=4]
103*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
104*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF2
105*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct A4 (base)
106*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     int a
107*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   (TestF2 vbtable pointer)
108*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   int a
109*f4a2713aSLionel Sambuc // CHECK-X64:   24 |   struct C4 (virtual base)
110*f4a2713aSLionel Sambuc // CHECK-X64:   24 |     (C4 vftable pointer)
111*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     int a
112*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=40, align=8
113*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=24, nvalign=8]
114*f4a2713aSLionel Sambuc 
115*f4a2713aSLionel Sambuc struct TestF3 : A4, virtual C16 {
116*f4a2713aSLionel Sambuc 	int a;
117*f4a2713aSLionel Sambuc 	TestF3() : a(0xf00000f3) {}
118*f4a2713aSLionel Sambuc };
119*f4a2713aSLionel Sambuc 
120*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
121*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF3
122*f4a2713aSLionel Sambuc // CHECK:    0 |   struct A4 (base)
123*f4a2713aSLionel Sambuc // CHECK:    0 |     int a
124*f4a2713aSLionel Sambuc // CHECK:    4 |   (TestF3 vbtable pointer)
125*f4a2713aSLionel Sambuc // CHECK:    8 |   int a
126*f4a2713aSLionel Sambuc // CHECK:   16 |   struct C16 (virtual base)
127*f4a2713aSLionel Sambuc // CHECK:   16 |     (C16 vftable pointer)
128*f4a2713aSLionel Sambuc // CHECK:   32 |     int a
129*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=48, align=16
130*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=12, nvalign=4]
131*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
132*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF3
133*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct A4 (base)
134*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     int a
135*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   (TestF3 vbtable pointer)
136*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   int a
137*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   struct C16 (virtual base)
138*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     (C16 vftable pointer)
139*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     int a
140*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=64, align=16
141*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=24, nvalign=8]
142*f4a2713aSLionel Sambuc 
143*f4a2713aSLionel Sambuc struct TestF4 : TestF3, A4 {
144*f4a2713aSLionel Sambuc 	int a;
145*f4a2713aSLionel Sambuc 	TestF4() : a(0xf00000f4) {}
146*f4a2713aSLionel Sambuc };
147*f4a2713aSLionel Sambuc 
148*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
149*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF4
150*f4a2713aSLionel Sambuc // CHECK:    0 |   struct TestF3 (base)
151*f4a2713aSLionel Sambuc // CHECK:    0 |     struct A4 (base)
152*f4a2713aSLionel Sambuc // CHECK:    0 |       int a
153*f4a2713aSLionel Sambuc // CHECK:    4 |     (TestF3 vbtable pointer)
154*f4a2713aSLionel Sambuc // CHECK:    8 |     int a
155*f4a2713aSLionel Sambuc // CHECK:   12 |   struct A4 (base)
156*f4a2713aSLionel Sambuc // CHECK:   12 |     int a
157*f4a2713aSLionel Sambuc // CHECK:   16 |   int a
158*f4a2713aSLionel Sambuc // CHECK:   32 |   struct C16 (virtual base)
159*f4a2713aSLionel Sambuc // CHECK:   32 |     (C16 vftable pointer)
160*f4a2713aSLionel Sambuc // CHECK:   48 |     int a
161*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=64, align=16
162*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=32, nvalign=16]
163*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
164*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF4
165*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct TestF3 (base)
166*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     struct A4 (base)
167*f4a2713aSLionel Sambuc // CHECK-X64:    0 |       int a
168*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     (TestF3 vbtable pointer)
169*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     int a
170*f4a2713aSLionel Sambuc // CHECK-X64:   24 |   struct A4 (base)
171*f4a2713aSLionel Sambuc // CHECK-X64:   24 |     int a
172*f4a2713aSLionel Sambuc // CHECK-X64:   28 |   int a
173*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   struct C16 (virtual base)
174*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     (C16 vftable pointer)
175*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     int a
176*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=64, align=16
177*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=32, nvalign=16]
178*f4a2713aSLionel Sambuc 
179*f4a2713aSLionel Sambuc struct TestF5 : TestF3, A4 {
180*f4a2713aSLionel Sambuc 	int a;
181*f4a2713aSLionel Sambuc 	TestF5() : a(0xf00000f5) {}
182*f4a2713aSLionel Sambuc 	virtual void g() {printf("F5");}
183*f4a2713aSLionel Sambuc };
184*f4a2713aSLionel Sambuc 
185*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
186*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF5
187*f4a2713aSLionel Sambuc // CHECK:    0 |   (TestF5 vftable pointer)
188*f4a2713aSLionel Sambuc // CHECK:   16 |   struct TestF3 (base)
189*f4a2713aSLionel Sambuc // CHECK:   16 |     struct A4 (base)
190*f4a2713aSLionel Sambuc // CHECK:   16 |       int a
191*f4a2713aSLionel Sambuc // CHECK:   20 |     (TestF3 vbtable pointer)
192*f4a2713aSLionel Sambuc // CHECK:   24 |     int a
193*f4a2713aSLionel Sambuc // CHECK:   28 |   struct A4 (base)
194*f4a2713aSLionel Sambuc // CHECK:   28 |     int a
195*f4a2713aSLionel Sambuc // CHECK:   32 |   int a
196*f4a2713aSLionel Sambuc // CHECK:   48 |   struct C16 (virtual base)
197*f4a2713aSLionel Sambuc // CHECK:   48 |     (C16 vftable pointer)
198*f4a2713aSLionel Sambuc // CHECK:   64 |     int a
199*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=80, align=16
200*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=48, nvalign=16]
201*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
202*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF5
203*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   (TestF5 vftable pointer)
204*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   struct TestF3 (base)
205*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     struct A4 (base)
206*f4a2713aSLionel Sambuc // CHECK-X64:   16 |       int a
207*f4a2713aSLionel Sambuc // CHECK-X64:   24 |     (TestF3 vbtable pointer)
208*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     int a
209*f4a2713aSLionel Sambuc // CHECK-X64:   40 |   struct A4 (base)
210*f4a2713aSLionel Sambuc // CHECK-X64:   40 |     int a
211*f4a2713aSLionel Sambuc // CHECK-X64:   44 |   int a
212*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct C16 (virtual base)
213*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     (C16 vftable pointer)
214*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     int a
215*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=80, align=16
216*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=48, nvalign=16]
217*f4a2713aSLionel Sambuc 
218*f4a2713aSLionel Sambuc struct TestF6 : TestF3, A4 {
219*f4a2713aSLionel Sambuc 	int a;
220*f4a2713aSLionel Sambuc 	TestF6() : a(0xf00000f6) {}
221*f4a2713aSLionel Sambuc 	virtual void f() {printf("F6");}
222*f4a2713aSLionel Sambuc };
223*f4a2713aSLionel Sambuc 
224*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
225*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF6
226*f4a2713aSLionel Sambuc // CHECK:    0 |   struct TestF3 (base)
227*f4a2713aSLionel Sambuc // CHECK:    0 |     struct A4 (base)
228*f4a2713aSLionel Sambuc // CHECK:    0 |       int a
229*f4a2713aSLionel Sambuc // CHECK:    4 |     (TestF3 vbtable pointer)
230*f4a2713aSLionel Sambuc // CHECK:    8 |     int a
231*f4a2713aSLionel Sambuc // CHECK:   12 |   struct A4 (base)
232*f4a2713aSLionel Sambuc // CHECK:   12 |     int a
233*f4a2713aSLionel Sambuc // CHECK:   16 |   int a
234*f4a2713aSLionel Sambuc // CHECK:   44 |   (vtordisp for vbase C16)
235*f4a2713aSLionel Sambuc // CHECK:   48 |   struct C16 (virtual base)
236*f4a2713aSLionel Sambuc // CHECK:   48 |     (C16 vftable pointer)
237*f4a2713aSLionel Sambuc // CHECK:   64 |     int a
238*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=80, align=16
239*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=32, nvalign=16]
240*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
241*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF6
242*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct TestF3 (base)
243*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     struct A4 (base)
244*f4a2713aSLionel Sambuc // CHECK-X64:    0 |       int a
245*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     (TestF3 vbtable pointer)
246*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     int a
247*f4a2713aSLionel Sambuc // CHECK-X64:   24 |   struct A4 (base)
248*f4a2713aSLionel Sambuc // CHECK-X64:   24 |     int a
249*f4a2713aSLionel Sambuc // CHECK-X64:   28 |   int a
250*f4a2713aSLionel Sambuc // CHECK-X64:   44 |   (vtordisp for vbase C16)
251*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct C16 (virtual base)
252*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     (C16 vftable pointer)
253*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     int a
254*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=80, align=16
255*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=32, nvalign=16]
256*f4a2713aSLionel Sambuc 
257*f4a2713aSLionel Sambuc struct TestF7 : A4, virtual C16 {
258*f4a2713aSLionel Sambuc 	int a;
259*f4a2713aSLionel Sambuc 	TestF7() : a(0xf00000f7) {}
260*f4a2713aSLionel Sambuc 	virtual void f() {printf("F7");}
261*f4a2713aSLionel Sambuc };
262*f4a2713aSLionel Sambuc 
263*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
264*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF7
265*f4a2713aSLionel Sambuc // CHECK:    0 |   struct A4 (base)
266*f4a2713aSLionel Sambuc // CHECK:    0 |     int a
267*f4a2713aSLionel Sambuc // CHECK:    4 |   (TestF7 vbtable pointer)
268*f4a2713aSLionel Sambuc // CHECK:    8 |   int a
269*f4a2713aSLionel Sambuc // CHECK:   28 |   (vtordisp for vbase C16)
270*f4a2713aSLionel Sambuc // CHECK:   32 |   struct C16 (virtual base)
271*f4a2713aSLionel Sambuc // CHECK:   32 |     (C16 vftable pointer)
272*f4a2713aSLionel Sambuc // CHECK:   48 |     int a
273*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=64, align=16
274*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=12, nvalign=4]
275*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
276*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF7
277*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct A4 (base)
278*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     int a
279*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   (TestF7 vbtable pointer)
280*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   int a
281*f4a2713aSLionel Sambuc // CHECK-X64:   44 |   (vtordisp for vbase C16)
282*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct C16 (virtual base)
283*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     (C16 vftable pointer)
284*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     int a
285*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=80, align=16
286*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=24, nvalign=8]
287*f4a2713aSLionel Sambuc 
288*f4a2713aSLionel Sambuc struct TestF8 : TestF7, A4 {
289*f4a2713aSLionel Sambuc 	int a;
290*f4a2713aSLionel Sambuc 	TestF8() : a(0xf00000f8) {}
291*f4a2713aSLionel Sambuc 	virtual void f() {printf("F8");}
292*f4a2713aSLionel Sambuc };
293*f4a2713aSLionel Sambuc 
294*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
295*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF8
296*f4a2713aSLionel Sambuc // CHECK:    0 |   struct TestF7 (base)
297*f4a2713aSLionel Sambuc // CHECK:    0 |     struct A4 (base)
298*f4a2713aSLionel Sambuc // CHECK:    0 |       int a
299*f4a2713aSLionel Sambuc // CHECK:    4 |     (TestF7 vbtable pointer)
300*f4a2713aSLionel Sambuc // CHECK:    8 |     int a
301*f4a2713aSLionel Sambuc // CHECK:   12 |   struct A4 (base)
302*f4a2713aSLionel Sambuc // CHECK:   12 |     int a
303*f4a2713aSLionel Sambuc // CHECK:   16 |   int a
304*f4a2713aSLionel Sambuc // CHECK:   44 |   (vtordisp for vbase C16)
305*f4a2713aSLionel Sambuc // CHECK:   48 |   struct C16 (virtual base)
306*f4a2713aSLionel Sambuc // CHECK:   48 |     (C16 vftable pointer)
307*f4a2713aSLionel Sambuc // CHECK:   64 |     int a
308*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=80, align=16
309*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=32, nvalign=16]
310*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
311*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF8
312*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct TestF7 (base)
313*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     struct A4 (base)
314*f4a2713aSLionel Sambuc // CHECK-X64:    0 |       int a
315*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     (TestF7 vbtable pointer)
316*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     int a
317*f4a2713aSLionel Sambuc // CHECK-X64:   24 |   struct A4 (base)
318*f4a2713aSLionel Sambuc // CHECK-X64:   24 |     int a
319*f4a2713aSLionel Sambuc // CHECK-X64:   28 |   int a
320*f4a2713aSLionel Sambuc // CHECK-X64:   44 |   (vtordisp for vbase C16)
321*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct C16 (virtual base)
322*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     (C16 vftable pointer)
323*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     int a
324*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=80, align=16
325*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=32, nvalign=16]
326*f4a2713aSLionel Sambuc 
327*f4a2713aSLionel Sambuc struct TestF9 : A4, virtual C16 {
328*f4a2713aSLionel Sambuc 	int a;
329*f4a2713aSLionel Sambuc 	TestF9() : a(0xf00000f9) {}
330*f4a2713aSLionel Sambuc 	virtual void g() {printf("F9");}
331*f4a2713aSLionel Sambuc };
332*f4a2713aSLionel Sambuc 
333*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
334*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestF9
335*f4a2713aSLionel Sambuc // CHECK:    0 |   (TestF9 vftable pointer)
336*f4a2713aSLionel Sambuc // CHECK:    4 |   struct A4 (base)
337*f4a2713aSLionel Sambuc // CHECK:    4 |     int a
338*f4a2713aSLionel Sambuc // CHECK:    8 |   (TestF9 vbtable pointer)
339*f4a2713aSLionel Sambuc // CHECK:   12 |   int a
340*f4a2713aSLionel Sambuc // CHECK:   16 |   struct C16 (virtual base)
341*f4a2713aSLionel Sambuc // CHECK:   16 |     (C16 vftable pointer)
342*f4a2713aSLionel Sambuc // CHECK:   32 |     int a
343*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=48, align=16
344*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=16, nvalign=4]
345*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
346*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestF9
347*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   (TestF9 vftable pointer)
348*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   struct A4 (base)
349*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     int a
350*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   (TestF9 vbtable pointer)
351*f4a2713aSLionel Sambuc // CHECK-X64:   24 |   int a
352*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   struct C16 (virtual base)
353*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     (C16 vftable pointer)
354*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     int a
355*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=64, align=16
356*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=32, nvalign=8]
357*f4a2713aSLionel Sambuc 
358*f4a2713aSLionel Sambuc struct TestFA : TestF9, A4 {
359*f4a2713aSLionel Sambuc 	int a;
360*f4a2713aSLionel Sambuc 	TestFA() : a(0xf00000fa) {}
361*f4a2713aSLionel Sambuc 	virtual void g() {printf("FA");}
362*f4a2713aSLionel Sambuc };
363*f4a2713aSLionel Sambuc 
364*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
365*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestFA
366*f4a2713aSLionel Sambuc // CHECK:    0 |   struct TestF9 (primary base)
367*f4a2713aSLionel Sambuc // CHECK:    0 |     (TestF9 vftable pointer)
368*f4a2713aSLionel Sambuc // CHECK:    4 |     struct A4 (base)
369*f4a2713aSLionel Sambuc // CHECK:    4 |       int a
370*f4a2713aSLionel Sambuc // CHECK:    8 |     (TestF9 vbtable pointer)
371*f4a2713aSLionel Sambuc // CHECK:   12 |     int a
372*f4a2713aSLionel Sambuc // CHECK:   16 |   struct A4 (base)
373*f4a2713aSLionel Sambuc // CHECK:   16 |     int a
374*f4a2713aSLionel Sambuc // CHECK:   20 |   int a
375*f4a2713aSLionel Sambuc // CHECK:   32 |   struct C16 (virtual base)
376*f4a2713aSLionel Sambuc // CHECK:   32 |     (C16 vftable pointer)
377*f4a2713aSLionel Sambuc // CHECK:   48 |     int a
378*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=64, align=16
379*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=32, nvalign=16]
380*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
381*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestFA
382*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct TestF9 (primary base)
383*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     (TestF9 vftable pointer)
384*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     struct A4 (base)
385*f4a2713aSLionel Sambuc // CHECK-X64:    8 |       int a
386*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     (TestF9 vbtable pointer)
387*f4a2713aSLionel Sambuc // CHECK-X64:   24 |     int a
388*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   struct A4 (base)
389*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     int a
390*f4a2713aSLionel Sambuc // CHECK-X64:   36 |   int a
391*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct C16 (virtual base)
392*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     (C16 vftable pointer)
393*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     int a
394*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=80, align=16
395*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=48, nvalign=16]
396*f4a2713aSLionel Sambuc 
397*f4a2713aSLionel Sambuc struct TestFB : A16, virtual C16 {
398*f4a2713aSLionel Sambuc 	int a;
399*f4a2713aSLionel Sambuc 	TestFB() : a(0xf00000fb) {}
400*f4a2713aSLionel Sambuc 	virtual void g() {printf("Fb");}
401*f4a2713aSLionel Sambuc };
402*f4a2713aSLionel Sambuc 
403*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
404*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestFB
405*f4a2713aSLionel Sambuc // CHECK:    0 |   (TestFB vftable pointer)
406*f4a2713aSLionel Sambuc // CHECK:   16 |   struct A16 (base)
407*f4a2713aSLionel Sambuc // CHECK:   16 |     int a
408*f4a2713aSLionel Sambuc // CHECK:   32 |   (TestFB vbtable pointer)
409*f4a2713aSLionel Sambuc // CHECK:   48 |   int a
410*f4a2713aSLionel Sambuc // CHECK:   64 |   struct C16 (virtual base)
411*f4a2713aSLionel Sambuc // CHECK:   64 |     (C16 vftable pointer)
412*f4a2713aSLionel Sambuc // CHECK:   80 |     int a
413*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=96, align=16
414*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=64, nvalign=16]
415*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
416*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestFB
417*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   (TestFB vftable pointer)
418*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   struct A16 (base)
419*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     int a
420*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   (TestFB vbtable pointer)
421*f4a2713aSLionel Sambuc // CHECK-X64:   40 |   int a
422*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct C16 (virtual base)
423*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     (C16 vftable pointer)
424*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     int a
425*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=80, align=16
426*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=48, nvalign=16]
427*f4a2713aSLionel Sambuc 
428*f4a2713aSLionel Sambuc struct TestFC : TestFB, A4 {
429*f4a2713aSLionel Sambuc 	int a;
430*f4a2713aSLionel Sambuc 	TestFC() : a(0xf00000fc) {}
431*f4a2713aSLionel Sambuc 	virtual void g() {printf("FC");}
432*f4a2713aSLionel Sambuc };
433*f4a2713aSLionel Sambuc 
434*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
435*f4a2713aSLionel Sambuc // CHECK:    0 | struct TestFC
436*f4a2713aSLionel Sambuc // CHECK:    0 |   struct TestFB (primary base)
437*f4a2713aSLionel Sambuc // CHECK:    0 |     (TestFB vftable pointer)
438*f4a2713aSLionel Sambuc // CHECK:   16 |     struct A16 (base)
439*f4a2713aSLionel Sambuc // CHECK:   16 |       int a
440*f4a2713aSLionel Sambuc // CHECK:   32 |     (TestFB vbtable pointer)
441*f4a2713aSLionel Sambuc // CHECK:   48 |     int a
442*f4a2713aSLionel Sambuc // CHECK:   64 |   struct A4 (base)
443*f4a2713aSLionel Sambuc // CHECK:   64 |     int a
444*f4a2713aSLionel Sambuc // CHECK:   68 |   int a
445*f4a2713aSLionel Sambuc // CHECK:   80 |   struct C16 (virtual base)
446*f4a2713aSLionel Sambuc // CHECK:   80 |     (C16 vftable pointer)
447*f4a2713aSLionel Sambuc // CHECK:   96 |     int a
448*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=112, align=16
449*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=80, nvalign=16]
450*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
451*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct TestFC
452*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct TestFB (primary base)
453*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     (TestFB vftable pointer)
454*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     struct A16 (base)
455*f4a2713aSLionel Sambuc // CHECK-X64:   16 |       int a
456*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     (TestFB vbtable pointer)
457*f4a2713aSLionel Sambuc // CHECK-X64:   40 |     int a
458*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct A4 (base)
459*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     int a
460*f4a2713aSLionel Sambuc // CHECK-X64:   52 |   int a
461*f4a2713aSLionel Sambuc // CHECK-X64:   64 |   struct C16 (virtual base)
462*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     (C16 vftable pointer)
463*f4a2713aSLionel Sambuc // CHECK-X64:   80 |     int a
464*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=96, align=16
465*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=64, nvalign=16]
466*f4a2713aSLionel Sambuc 
467*f4a2713aSLionel Sambuc 
468*f4a2713aSLionel Sambuc struct A16f {
469*f4a2713aSLionel Sambuc 	__declspec(align(16)) int a;
470*f4a2713aSLionel Sambuc 	A16f() : a(0xf0000a16) {}
471*f4a2713aSLionel Sambuc 	virtual void f() {printf("A16f");}
472*f4a2713aSLionel Sambuc };
473*f4a2713aSLionel Sambuc 
474*f4a2713aSLionel Sambuc struct Y { char y; Y() : y(0xaa) {} };
475*f4a2713aSLionel Sambuc struct X : virtual A16f {};
476*f4a2713aSLionel Sambuc 
477*f4a2713aSLionel Sambuc struct B : A4, Y, X {
478*f4a2713aSLionel Sambuc 	int a;
479*f4a2713aSLionel Sambuc 	B() : a(0xf000000b) {}
480*f4a2713aSLionel Sambuc };
481*f4a2713aSLionel Sambuc 
482*f4a2713aSLionel Sambuc struct F0 : A4, B {
483*f4a2713aSLionel Sambuc 	int a;
484*f4a2713aSLionel Sambuc 	F0() : a(0xf00000f0) {}
485*f4a2713aSLionel Sambuc 	virtual void g() {printf("F0");}
486*f4a2713aSLionel Sambuc };
487*f4a2713aSLionel Sambuc 
488*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
489*f4a2713aSLionel Sambuc // CHECK:    0 | struct F0
490*f4a2713aSLionel Sambuc // CHECK:    0 |   (F0 vftable pointer)
491*f4a2713aSLionel Sambuc // CHECK:   16 |   struct A4 (base)
492*f4a2713aSLionel Sambuc // CHECK:   16 |     int a
493*f4a2713aSLionel Sambuc // CHECK:   32 |   struct B (base)
494*f4a2713aSLionel Sambuc // CHECK:   32 |     struct A4 (base)
495*f4a2713aSLionel Sambuc // CHECK:   32 |       int a
496*f4a2713aSLionel Sambuc // CHECK:   36 |     struct Y (base)
497*f4a2713aSLionel Sambuc // CHECK:   36 |       char y
498*f4a2713aSLionel Sambuc // CHECK:   48 |     struct X (base)
499*f4a2713aSLionel Sambuc // CHECK:   48 |       (X vbtable pointer)
500*f4a2713aSLionel Sambuc // CHECK:   52 |     int a
501*f4a2713aSLionel Sambuc // CHECK:   64 |   int a
502*f4a2713aSLionel Sambuc // CHECK:   80 |   struct A16f (virtual base)
503*f4a2713aSLionel Sambuc // CHECK:   80 |     (A16f vftable pointer)
504*f4a2713aSLionel Sambuc // CHECK:   96 |     int a
505*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=112, align=16
506*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=80, nvalign=16]
507*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
508*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct F0
509*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   (F0 vftable pointer)
510*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   struct A4 (base)
511*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     int a
512*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   struct B (base)
513*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     struct A4 (base)
514*f4a2713aSLionel Sambuc // CHECK-X64:   16 |       int a
515*f4a2713aSLionel Sambuc // CHECK-X64:   20 |     struct Y (base)
516*f4a2713aSLionel Sambuc // CHECK-X64:   20 |       char y
517*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     struct X (base)
518*f4a2713aSLionel Sambuc // CHECK-X64:   32 |       (X vbtable pointer)
519*f4a2713aSLionel Sambuc // CHECK-X64:   40 |     int a
520*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   int a
521*f4a2713aSLionel Sambuc // CHECK-X64:   64 |   struct A16f (virtual base)
522*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     (A16f vftable pointer)
523*f4a2713aSLionel Sambuc // CHECK-X64:   80 |     int a
524*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=96, align=16
525*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=64, nvalign=16]
526*f4a2713aSLionel Sambuc 
527*f4a2713aSLionel Sambuc struct F1 : B, A4 {
528*f4a2713aSLionel Sambuc 	int a;
529*f4a2713aSLionel Sambuc 	F1() : a(0xf00000f1) {}
530*f4a2713aSLionel Sambuc 	virtual void g() {printf("F1");}
531*f4a2713aSLionel Sambuc };
532*f4a2713aSLionel Sambuc 
533*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
534*f4a2713aSLionel Sambuc // CHECK:    0 | struct F1
535*f4a2713aSLionel Sambuc // CHECK:    0 |   (F1 vftable pointer)
536*f4a2713aSLionel Sambuc // CHECK:   16 |   struct B (base)
537*f4a2713aSLionel Sambuc // CHECK:   16 |     struct A4 (base)
538*f4a2713aSLionel Sambuc // CHECK:   16 |       int a
539*f4a2713aSLionel Sambuc // CHECK:   20 |     struct Y (base)
540*f4a2713aSLionel Sambuc // CHECK:   20 |       char y
541*f4a2713aSLionel Sambuc // CHECK:   32 |     struct X (base)
542*f4a2713aSLionel Sambuc // CHECK:   32 |       (X vbtable pointer)
543*f4a2713aSLionel Sambuc // CHECK:   36 |     int a
544*f4a2713aSLionel Sambuc // CHECK:   48 |   struct A4 (base)
545*f4a2713aSLionel Sambuc // CHECK:   48 |     int a
546*f4a2713aSLionel Sambuc // CHECK:   52 |   int a
547*f4a2713aSLionel Sambuc // CHECK:   64 |   struct A16f (virtual base)
548*f4a2713aSLionel Sambuc // CHECK:   64 |     (A16f vftable pointer)
549*f4a2713aSLionel Sambuc // CHECK:   80 |     int a
550*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=96, align=16
551*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=64, nvalign=16]
552*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
553*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct F1
554*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   (F1 vftable pointer)
555*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   struct B (base)
556*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     struct A4 (base)
557*f4a2713aSLionel Sambuc // CHECK-X64:   16 |       int a
558*f4a2713aSLionel Sambuc // CHECK-X64:   20 |     struct Y (base)
559*f4a2713aSLionel Sambuc // CHECK-X64:   20 |       char y
560*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     struct X (base)
561*f4a2713aSLionel Sambuc // CHECK-X64:   32 |       (X vbtable pointer)
562*f4a2713aSLionel Sambuc // CHECK-X64:   40 |     int a
563*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct A4 (base)
564*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     int a
565*f4a2713aSLionel Sambuc // CHECK-X64:   52 |   int a
566*f4a2713aSLionel Sambuc // CHECK-X64:   64 |   struct A16f (virtual base)
567*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     (A16f vftable pointer)
568*f4a2713aSLionel Sambuc // CHECK-X64:   80 |     int a
569*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=96, align=16
570*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=64, nvalign=16]
571*f4a2713aSLionel Sambuc 
572*f4a2713aSLionel Sambuc struct F2 : A4, virtual A16f {
573*f4a2713aSLionel Sambuc 	int a;
574*f4a2713aSLionel Sambuc 	F2() : a(0xf00000f2) {}
575*f4a2713aSLionel Sambuc 	virtual void g() {printf("F2");}
576*f4a2713aSLionel Sambuc };
577*f4a2713aSLionel Sambuc 
578*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
579*f4a2713aSLionel Sambuc // CHECK:    0 | struct F2
580*f4a2713aSLionel Sambuc // CHECK:    0 |   (F2 vftable pointer)
581*f4a2713aSLionel Sambuc // CHECK:    4 |   struct A4 (base)
582*f4a2713aSLionel Sambuc // CHECK:    4 |     int a
583*f4a2713aSLionel Sambuc // CHECK:    8 |   (F2 vbtable pointer)
584*f4a2713aSLionel Sambuc // CHECK:   12 |   int a
585*f4a2713aSLionel Sambuc // CHECK:   16 |   struct A16f (virtual base)
586*f4a2713aSLionel Sambuc // CHECK:   16 |     (A16f vftable pointer)
587*f4a2713aSLionel Sambuc // CHECK:   32 |     int a
588*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=48, align=16
589*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=16, nvalign=4]
590*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
591*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct F2
592*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   (F2 vftable pointer)
593*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   struct A4 (base)
594*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     int a
595*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   (F2 vbtable pointer)
596*f4a2713aSLionel Sambuc // CHECK-X64:   24 |   int a
597*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   struct A16f (virtual base)
598*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     (A16f vftable pointer)
599*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     int a
600*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=64, align=16
601*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=32, nvalign=8]
602*f4a2713aSLionel Sambuc 
603*f4a2713aSLionel Sambuc struct F3 : A4, virtual A16f {
604*f4a2713aSLionel Sambuc 	__declspec(align(16)) int a;
605*f4a2713aSLionel Sambuc 	F3() : a(0xf00000f3) {}
606*f4a2713aSLionel Sambuc 	virtual void g() {printf("F3");}
607*f4a2713aSLionel Sambuc };
608*f4a2713aSLionel Sambuc 
609*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
610*f4a2713aSLionel Sambuc // CHECK:    0 | struct F3
611*f4a2713aSLionel Sambuc // CHECK:    0 |   (F3 vftable pointer)
612*f4a2713aSLionel Sambuc // CHECK:   16 |   struct A4 (base)
613*f4a2713aSLionel Sambuc // CHECK:   16 |     int a
614*f4a2713aSLionel Sambuc // CHECK:   20 |   (F3 vbtable pointer)
615*f4a2713aSLionel Sambuc // CHECK:   48 |   int a
616*f4a2713aSLionel Sambuc // CHECK:   64 |   struct A16f (virtual base)
617*f4a2713aSLionel Sambuc // CHECK:   64 |     (A16f vftable pointer)
618*f4a2713aSLionel Sambuc // CHECK:   80 |     int a
619*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=96, align=16
620*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=64, nvalign=16]
621*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
622*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct F3
623*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   (F3 vftable pointer)
624*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   struct A4 (base)
625*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     int a
626*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   (F3 vbtable pointer)
627*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   int a
628*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct A16f (virtual base)
629*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     (A16f vftable pointer)
630*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     int a
631*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=80, align=16
632*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=48, nvalign=16]
633*f4a2713aSLionel Sambuc 
634*f4a2713aSLionel Sambuc struct F4 : A4, B {
635*f4a2713aSLionel Sambuc 	__declspec(align(16)) int a;
636*f4a2713aSLionel Sambuc 	F4() : a(0xf00000f4) {}
637*f4a2713aSLionel Sambuc 	virtual void g() {printf("F4");}
638*f4a2713aSLionel Sambuc };
639*f4a2713aSLionel Sambuc 
640*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
641*f4a2713aSLionel Sambuc // CHECK:    0 | struct F4
642*f4a2713aSLionel Sambuc // CHECK:    0 |   (F4 vftable pointer)
643*f4a2713aSLionel Sambuc // CHECK:   16 |   struct A4 (base)
644*f4a2713aSLionel Sambuc // CHECK:   16 |     int a
645*f4a2713aSLionel Sambuc // CHECK:   32 |   struct B (base)
646*f4a2713aSLionel Sambuc // CHECK:   32 |     struct A4 (base)
647*f4a2713aSLionel Sambuc // CHECK:   32 |       int a
648*f4a2713aSLionel Sambuc // CHECK:   36 |     struct Y (base)
649*f4a2713aSLionel Sambuc // CHECK:   36 |       char y
650*f4a2713aSLionel Sambuc // CHECK:   48 |     struct X (base)
651*f4a2713aSLionel Sambuc // CHECK:   48 |       (X vbtable pointer)
652*f4a2713aSLionel Sambuc // CHECK:   52 |     int a
653*f4a2713aSLionel Sambuc // CHECK:   64 |   int a
654*f4a2713aSLionel Sambuc // CHECK:   80 |   struct A16f (virtual base)
655*f4a2713aSLionel Sambuc // CHECK:   80 |     (A16f vftable pointer)
656*f4a2713aSLionel Sambuc // CHECK:   96 |     int a
657*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=112, align=16
658*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=80, nvalign=16]
659*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
660*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct F4
661*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   (F4 vftable pointer)
662*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   struct A4 (base)
663*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     int a
664*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   struct B (base)
665*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     struct A4 (base)
666*f4a2713aSLionel Sambuc // CHECK-X64:   16 |       int a
667*f4a2713aSLionel Sambuc // CHECK-X64:   20 |     struct Y (base)
668*f4a2713aSLionel Sambuc // CHECK-X64:   20 |       char y
669*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     struct X (base)
670*f4a2713aSLionel Sambuc // CHECK-X64:   32 |       (X vbtable pointer)
671*f4a2713aSLionel Sambuc // CHECK-X64:   40 |     int a
672*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   int a
673*f4a2713aSLionel Sambuc // CHECK-X64:   64 |   struct A16f (virtual base)
674*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     (A16f vftable pointer)
675*f4a2713aSLionel Sambuc // CHECK-X64:   80 |     int a
676*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=96, align=16
677*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=64, nvalign=16]
678*f4a2713aSLionel Sambuc 
679*f4a2713aSLionel Sambuc struct F5 : A16f, virtual A4 {
680*f4a2713aSLionel Sambuc 	int a;
681*f4a2713aSLionel Sambuc 	F5() : a(0xf00000f5) {}
682*f4a2713aSLionel Sambuc 	virtual void g() {printf("F5");}
683*f4a2713aSLionel Sambuc };
684*f4a2713aSLionel Sambuc 
685*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
686*f4a2713aSLionel Sambuc // CHECK:    0 | struct F5
687*f4a2713aSLionel Sambuc // CHECK:    0 |   struct A16f (primary base)
688*f4a2713aSLionel Sambuc // CHECK:    0 |     (A16f vftable pointer)
689*f4a2713aSLionel Sambuc // CHECK:   16 |     int a
690*f4a2713aSLionel Sambuc // CHECK:   32 |   (F5 vbtable pointer)
691*f4a2713aSLionel Sambuc // CHECK:   48 |   int a
692*f4a2713aSLionel Sambuc // CHECK:   64 |   struct A4 (virtual base)
693*f4a2713aSLionel Sambuc // CHECK:   64 |     int a
694*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=80, align=16
695*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=64, nvalign=16]
696*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
697*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct F5
698*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   struct A16f (primary base)
699*f4a2713aSLionel Sambuc // CHECK-X64:    0 |     (A16f vftable pointer)
700*f4a2713aSLionel Sambuc // CHECK-X64:   16 |     int a
701*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   (F5 vbtable pointer)
702*f4a2713aSLionel Sambuc // CHECK-X64:   40 |   int a
703*f4a2713aSLionel Sambuc // CHECK-X64:   48 |   struct A4 (virtual base)
704*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     int a
705*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=64, align=16
706*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=48, nvalign=16]
707*f4a2713aSLionel Sambuc 
708*f4a2713aSLionel Sambuc struct F6 : virtual A16f, A4, virtual B {
709*f4a2713aSLionel Sambuc 	int a;
710*f4a2713aSLionel Sambuc 	F6() : a(0xf00000f6) {}
711*f4a2713aSLionel Sambuc 	virtual void g() {printf("F6");}
712*f4a2713aSLionel Sambuc };
713*f4a2713aSLionel Sambuc 
714*f4a2713aSLionel Sambuc // CHECK: *** Dumping AST Record Layout
715*f4a2713aSLionel Sambuc // CHECK:    0 | struct F6
716*f4a2713aSLionel Sambuc // CHECK:    0 |   (F6 vftable pointer)
717*f4a2713aSLionel Sambuc // CHECK:    4 |   struct A4 (base)
718*f4a2713aSLionel Sambuc // CHECK:    4 |     int a
719*f4a2713aSLionel Sambuc // CHECK:    8 |   (F6 vbtable pointer)
720*f4a2713aSLionel Sambuc // CHECK:   12 |   int a
721*f4a2713aSLionel Sambuc // CHECK:   16 |   struct A16f (virtual base)
722*f4a2713aSLionel Sambuc // CHECK:   16 |     (A16f vftable pointer)
723*f4a2713aSLionel Sambuc // CHECK:   32 |     int a
724*f4a2713aSLionel Sambuc // CHECK:   48 |   struct B (virtual base)
725*f4a2713aSLionel Sambuc // CHECK:   48 |     struct A4 (base)
726*f4a2713aSLionel Sambuc // CHECK:   48 |       int a
727*f4a2713aSLionel Sambuc // CHECK:   52 |     struct Y (base)
728*f4a2713aSLionel Sambuc // CHECK:   52 |       char y
729*f4a2713aSLionel Sambuc // CHECK:   64 |     struct X (base)
730*f4a2713aSLionel Sambuc // CHECK:   64 |       (X vbtable pointer)
731*f4a2713aSLionel Sambuc // CHECK:   68 |     int a
732*f4a2713aSLionel Sambuc // CHECK:      | [sizeof=80, align=16
733*f4a2713aSLionel Sambuc // CHECK:      |  nvsize=16, nvalign=4]
734*f4a2713aSLionel Sambuc // CHECK-X64: *** Dumping AST Record Layout
735*f4a2713aSLionel Sambuc // CHECK-X64:    0 | struct F6
736*f4a2713aSLionel Sambuc // CHECK-X64:    0 |   (F6 vftable pointer)
737*f4a2713aSLionel Sambuc // CHECK-X64:    8 |   struct A4 (base)
738*f4a2713aSLionel Sambuc // CHECK-X64:    8 |     int a
739*f4a2713aSLionel Sambuc // CHECK-X64:   16 |   (F6 vbtable pointer)
740*f4a2713aSLionel Sambuc // CHECK-X64:   24 |   int a
741*f4a2713aSLionel Sambuc // CHECK-X64:   32 |   struct A16f (virtual base)
742*f4a2713aSLionel Sambuc // CHECK-X64:   32 |     (A16f vftable pointer)
743*f4a2713aSLionel Sambuc // CHECK-X64:   48 |     int a
744*f4a2713aSLionel Sambuc // CHECK-X64:   64 |   struct B (virtual base)
745*f4a2713aSLionel Sambuc // CHECK-X64:   64 |     struct A4 (base)
746*f4a2713aSLionel Sambuc // CHECK-X64:   64 |       int a
747*f4a2713aSLionel Sambuc // CHECK-X64:   68 |     struct Y (base)
748*f4a2713aSLionel Sambuc // CHECK-X64:   68 |       char y
749*f4a2713aSLionel Sambuc // CHECK-X64:   80 |     struct X (base)
750*f4a2713aSLionel Sambuc // CHECK-X64:   80 |       (X vbtable pointer)
751*f4a2713aSLionel Sambuc // CHECK-X64:   88 |     int a
752*f4a2713aSLionel Sambuc // CHECK-X64:      | [sizeof=96, align=16
753*f4a2713aSLionel Sambuc // CHECK-X64:      |  nvsize=32, nvalign=8]
754*f4a2713aSLionel Sambuc 
755*f4a2713aSLionel Sambuc int a[
756*f4a2713aSLionel Sambuc sizeof(TestF0)+
757*f4a2713aSLionel Sambuc sizeof(TestF1)+
758*f4a2713aSLionel Sambuc sizeof(TestF2)+
759*f4a2713aSLionel Sambuc sizeof(TestF3)+
760*f4a2713aSLionel Sambuc sizeof(TestF4)+
761*f4a2713aSLionel Sambuc sizeof(TestF5)+
762*f4a2713aSLionel Sambuc sizeof(TestF6)+
763*f4a2713aSLionel Sambuc sizeof(TestF7)+
764*f4a2713aSLionel Sambuc sizeof(TestF8)+
765*f4a2713aSLionel Sambuc sizeof(TestF9)+
766*f4a2713aSLionel Sambuc sizeof(TestFA)+
767*f4a2713aSLionel Sambuc sizeof(TestFB)+
768*f4a2713aSLionel Sambuc sizeof(TestFC)+
769*f4a2713aSLionel Sambuc sizeof(F0)+
770*f4a2713aSLionel Sambuc sizeof(F1)+
771*f4a2713aSLionel Sambuc sizeof(F2)+
772*f4a2713aSLionel Sambuc sizeof(F3)+
773*f4a2713aSLionel Sambuc sizeof(F4)+
774*f4a2713aSLionel Sambuc sizeof(F5)+
775*f4a2713aSLionel Sambuc sizeof(F6)];
776