[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / pragma-pack.cpp
blobe468cce7f07095c63554ac67a4b45eb7e9e73ff1
1 // RUN: %clang_cc1 -triple i686-apple-darwin9 -fsyntax-only -verify %s
2 // expected-no-diagnostics
4 namespace rdar8745206 {
6 struct Base {
7 int i;
8 };
10 #pragma pack(push, 1)
11 struct Sub : public Base {
12 char c;
14 #pragma pack(pop)
16 int check[sizeof(Sub) == 5 ? 1 : -1];
20 namespace check2 {
22 struct Base {
23 virtual ~Base();
24 int x;
27 #pragma pack(push, 1)
28 struct Sub : virtual Base {
29 char c;
31 #pragma pack(pop)
33 int check[sizeof(Sub) == 13 ? 1 : -1];
37 namespace llvm_support_endian {
39 template<typename, bool> struct X;
41 #pragma pack(push)
42 #pragma pack(1)
43 template<typename T> struct X<T, true> {
44 T t;
46 #pragma pack(pop)
48 #pragma pack(push)
49 #pragma pack(2)
50 template<> struct X<long double, true> {
51 long double c;
53 #pragma pack(pop)
55 int check1[__alignof(X<int, true>) == 1 ? 1 : -1];
56 int check2[__alignof(X<long double, true>) == 2 ? 1 : -1];