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