1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -emit-pch -o %t.1 %s
2 // RUN: %clang_cc1 -triple x86_64-linux-gnu -error-on-deserialized-decl S1_keyfunc -error-on-deserialized-decl S3 -error-on-deserialized-decl DND -std=c++11 -include-pch %t.1 -emit-pch -o %t.2 %s
3 // RUN: %clang_cc1 -triple x86_64-linux-gnu -error-on-deserialized-decl S1_method -error-on-deserialized-decl S3 -error-on-deserialized-decl DND -std=c++11 -include-pch %t.2 -emit-llvm-only %s
4
5 // FIXME: Why does this require an x86 target?
6 // REQUIRES: x86-registered-target
7
8 #ifndef HEADER1
9 #define HEADER1
10 // Header.
11
12 struct S1 {
13 void S1_method();
14 virtual void S1_keyfunc();
15 };
16
17 struct S3 {};
18
19 struct S2 {
20 operator S3();
21 };
22
23 namespace vars {
f()24 constexpr int f() { return 0; }
Xvars::X25 struct X { constexpr X() {} };
26 namespace v1 { const int DND = 0; }
27 namespace v2 { constexpr int DND = f(); }
28 namespace v3 { static X DND; }
29 namespace v4 { constexpr X DND = {}; }
30 }
31
32 #elif !defined(HEADER2)
33 #define HEADER2
34
35 // Chained PCH.
36 S1 *s1;
37 S2 *s2;
38
39 #else
40
41 // Using the headers.
42
test(S1 *,S2 *)43 void test(S1*, S2*) {
44 }
45
46 #endif
47