1// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -verify -ffreestanding 2// <rdar://problem/10494810> and PR9560 3// Check #pragma pack handling with bitfields. 4 5#include <stddef.h> 6#pragma pack(2) 7 8struct s0 { 9 char f1; 10 unsigned f2 : 32; 11 char f3; 12}; 13extern int check[sizeof(struct s0) == 6 ? 1 : -1]; 14 15struct s1 { 16 char f1; 17 unsigned : 0; 18 char f3; 19}; 20extern int check[sizeof(struct s1) == 5 ? 1 : -1]; 21 22struct s2 { 23 char f1; 24 unsigned : 0; 25 unsigned f3 : 8; 26 char f4; 27}; 28extern int check[sizeof(struct s2) == 6 ? 1 : -1]; 29 30struct s3 { 31 char f1; 32 unsigned : 0; 33 unsigned f3 : 16; 34 char f4; 35}; 36extern int check[sizeof(struct s3) == 8 ? 1 : -1]; 37extern int check[offsetof(struct s3, f4) == 6 ? 1 : -1]; 38 39struct s4 { 40 char f1; 41 unsigned f2 : 8; 42 char f3; 43}; 44extern int check[sizeof(struct s4) == 4 ? 1 : -1]; 45extern int check[offsetof(struct s4, f3) == 2 ? 1 : -1]; 46