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