1*779355f9SNico Weber // Test this without pch.
2*779355f9SNico Weber // RUN: %clang_cc1 %s -Wunknown-pragmas -Werror -triple i386-apple-darwin9 -fsyntax-only -include %s -verify -std=c++11
3*779355f9SNico Weber 
4*779355f9SNico Weber // Test with pch.
5*779355f9SNico Weber // RUN: %clang_cc1 %s -Wunknown-pragmas -Werror -triple i386-apple-darwin9 -emit-pch -o %t -std=c++11
6*779355f9SNico Weber // RUN: %clang_cc1 %s -Wunknown-pragmas -Werror -triple i386-apple-darwin9 -fsyntax-only -include-pch %t -verify -std=c++11
7*779355f9SNico Weber 
8*779355f9SNico Weber // The first run line creates a pch, and since at that point HEADER is not
9*779355f9SNico Weber // defined, the only thing contained in the pch is the pragma. The second line
10*779355f9SNico Weber // then includes that pch, so HEADER is defined and the actual code is compiled.
11*779355f9SNico Weber // The check then makes sure that the pragma is in effect in the file that
12*779355f9SNico Weber // includes the pch.
13*779355f9SNico Weber 
14*779355f9SNico Weber // expected-no-diagnostics
15*779355f9SNico Weber 
16*779355f9SNico Weber #ifndef HEADER
17*779355f9SNico Weber #define HEADER
18*779355f9SNico Weber struct SOffH {
19*779355f9SNico Weber   short m : 9;
20*779355f9SNico Weber   int q : 12;
21*779355f9SNico Weber };
22*779355f9SNico Weber 
23*779355f9SNico Weber #pragma ms_struct on
24*779355f9SNico Weber 
25*779355f9SNico Weber struct SOnH {
26*779355f9SNico Weber   short m : 9;
27*779355f9SNico Weber   int q : 12;
28*779355f9SNico Weber };
29*779355f9SNico Weber 
30*779355f9SNico Weber #else
31*779355f9SNico Weber 
32*779355f9SNico Weber struct SOnC {
33*779355f9SNico Weber   short m : 9;
34*779355f9SNico Weber   int q : 12;
35*779355f9SNico Weber };
36*779355f9SNico Weber 
37*779355f9SNico Weber static_assert(sizeof(SOffH) == 4, "");
38*779355f9SNico Weber static_assert(sizeof(SOnH) == 8, "");
39*779355f9SNico Weber static_assert(sizeof(SOnC) == 8, "");
40*779355f9SNico Weber 
41*779355f9SNico Weber #endif
42