1 // RUN: %clang_cc1 -triple i686-apple-darwin9 -fsyntax-only -verify %s 2 // expected-no-diagnostics 3 4 namespace rdar8745206 { 5 6 struct Base { 7 int i; 8 }; 9 10 #pragma pack(push, 1) 11 struct Sub : public Base { 12 char c; 13 }; 14 #pragma pack(pop) 15 16 int check[sizeof(Sub) == 5 ? 1 : -1]; 17 18 } 19 20 namespace check2 { 21 22 struct Base { 23 virtual ~Base(); 24 int x; 25 }; 26 27 #pragma pack(push, 1) 28 struct Sub : virtual Base { 29 char c; 30 }; 31 #pragma pack(pop) 32 33 int check[sizeof(Sub) == 13 ? 1 : -1]; 34 35 } 36 37 namespace llvm_support_endian { 38 39 template<typename, bool> struct X; 40 41 #pragma pack(push) 42 #pragma pack(1) 43 template<typename T> struct X<T, true> { 44 T t; 45 }; 46 #pragma pack(pop) 47 48 #pragma pack(push) 49 #pragma pack(2) 50 template<> struct X<long double, true> { 51 long double c; 52 }; 53 #pragma pack(pop) 54 55 int check1[__alignof(X<int, true>) == 1 ? 1 : -1]; 56 int check2[__alignof(X<long double, true>) == 2 ? 1 : -1]; 57 58 } 59