[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Sema / pragma-pack-5.c
blob24bd4cd7d9221ca81b2a05ff3f07ced507b04ed6
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -verify -ffreestanding
2 // expected-no-diagnostics
3 // <rdar://problem/10494810> and PR9560
4 // Check #pragma pack handling with bitfields.
6 #include <stddef.h>
7 #pragma pack(2)
9 struct s0 {
10 char f1;
11 unsigned f2 : 32;
12 char f3;
14 extern int check[sizeof(struct s0) == 6 ? 1 : -1];
16 struct s1 {
17 char f1;
18 unsigned : 0;
19 char f3;
21 extern int check[sizeof(struct s1) == 5 ? 1 : -1];
23 struct s2 {
24 char f1;
25 unsigned : 0;
26 unsigned f3 : 8;
27 char f4;
29 extern int check[sizeof(struct s2) == 6 ? 1 : -1];
31 struct s3 {
32 char f1;
33 unsigned : 0;
34 unsigned f3 : 16;
35 char f4;
37 extern int check[sizeof(struct s3) == 8 ? 1 : -1];
38 extern int check[offsetof(struct s3, f4) == 6 ? 1 : -1];
40 struct s4 {
41 char f1;
42 unsigned f2 : 8;
43 char f3;
45 extern int check[sizeof(struct s4) == 4 ? 1 : -1];
46 extern int check[offsetof(struct s4, f3) == 2 ? 1 : -1];