override-layout-packed-base.cpp
735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// RUN: %clang_cc1 -triple i686-windows-msvc -w -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-layout-packed-base.layout %s | FileCheck %s
//#pragma pack(push, 1)
// CHECK: Type: class B<0>
// CHECK: Size:40
// CHECK: FieldOffsets: [0, 32]
// CHECK: Type: class B<1>
// CHECK: Size:40
// CHECK: FieldOffsets: [0, 32]
template<int I>
class B {
int _b1;
char _b2;
};
// CHECK: Type: class C
// CHECK: Size:88
// CHECK: FieldOffsets: [80]
class C : B<0>, B<1> {
char _c;
};
// CHECK: Type: class D
// CHECK: Size:120
// CHECK: FieldOffsets: [32]
class D : virtual B<0>, virtual B<1> {
char _d;
};
//#pragma pack(pop)
void use_structs() {
C cs[sizeof(C)];
D ds[sizeof(D)];
}