1// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
2// RUN:            | FileCheck %s
3// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \
4// RUN:            | FileCheck %s
5
6struct EmptyIntMemb {
7  int FlexArrayMemb[0];
8};
9// CHECK: *** Dumping AST Record Layout
10// CHECK: Type: struct EmptyIntMemb
11// CHECK: Record:
12// CHECK: Layout: <ASTRecordLayout
13// CHECK:     Size:32
14// CHECK:     Alignment:32
15// CHECK:     FieldOffsets: [0]>
16
17struct EmptyLongLongMemb {
18  long long FlexArrayMemb[0];
19};
20// CHECK: *** Dumping AST Record Layout
21// CHECK: Type: struct EmptyLongLongMemb
22// CHECK: Record:
23// CHECK: Layout: <ASTRecordLayout
24// CHECK:     Size:32
25// CHECK:     Alignment:64
26// CHECK:     FieldOffsets: [0]>
27
28struct EmptyAligned2LongLongMemb {
29  long long __declspec(align(2)) FlexArrayMemb[0];
30};
31
32// CHECK: *** Dumping AST Record Layout
33// CHECK: Type: struct EmptyAligned2LongLongMemb
34// CHECK: Record:
35// CHECK: Layout: <ASTRecordLayout
36// CHECK:     Size:32
37// CHECK:     Alignment:64
38// CHECK:     FieldOffsets: [0]>
39
40struct EmptyAligned8LongLongMemb {
41  long long __declspec(align(8)) FlexArrayMemb[0];
42};
43
44// CHECK: *** Dumping AST Record Layout
45// CHECK: Type: struct EmptyAligned8LongLongMemb
46// CHECK: Record:
47// CHECK: Layout: <ASTRecordLayout
48// CHECK:     Size:64
49// CHECK:     Alignment:64
50// CHECK:     FieldOffsets: [0]>
51
52#pragma pack(1)
53struct __declspec(align(4)) EmptyPackedAligned4LongLongMemb {
54  long long FlexArrayMemb[0];
55};
56#pragma pack()
57
58// CHECK: *** Dumping AST Record Layout
59// CHECK: Type: struct EmptyPackedAligned4LongLongMemb
60// CHECK: Record:
61// CHECK: Layout: <ASTRecordLayout
62// CHECK:     Size:32
63// CHECK:     Alignment:32
64// CHECK:     FieldOffsets: [0]>
65
66#pragma pack(1)
67struct EmptyPackedAligned8LongLongMemb {
68  long long __declspec(align(8)) FlexArrayMemb[0];
69};
70#pragma pack()
71
72// CHECK: *** Dumping AST Record Layout
73// CHECK: Type: struct EmptyPackedAligned8LongLongMemb
74// CHECK: Record:
75// CHECK: Layout: <ASTRecordLayout
76// CHECK:     Size:64
77// CHECK:     Alignment:64
78// CHECK:     FieldOffsets: [0]>
79
80
81int a[
82sizeof(struct EmptyIntMemb)+
83sizeof(struct EmptyLongLongMemb)+
84sizeof(struct EmptyAligned2LongLongMemb)+
85sizeof(struct EmptyAligned8LongLongMemb)+
86sizeof(struct EmptyPackedAligned4LongLongMemb)+
87sizeof(struct EmptyPackedAligned8LongLongMemb)+
880];
89