1a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -emit-pch -o %t.1 %s
2a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar// 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
3a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar// 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
40e2c34f92f00628d48968dfea096d36381f494cbStephen Hines
50e2c34f92f00628d48968dfea096d36381f494cbStephen Hines// FIXME: Why does this require an x86 target?
60e2c34f92f00628d48968dfea096d36381f494cbStephen Hines// REQUIRES: x86-registered-target
7eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis
8cd03f862d82cac28c9517e2036716f8d49112c8bRichard Smith#ifndef HEADER1
9cd03f862d82cac28c9517e2036716f8d49112c8bRichard Smith#define HEADER1
10eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis// Header.
11eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis
12eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidisstruct S1 {
13cd03f862d82cac28c9517e2036716f8d49112c8bRichard Smith  void S1_method();
1436d2fd44bfeec417bbd7465218353abb8bf7e95dArgyrios Kyrtzidis  virtual void S1_keyfunc();
15eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis};
16eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis
17c2d775714f79af977672e4f1dbc16ee9e02d1deaRichard Smithstruct S3 {};
18c2d775714f79af977672e4f1dbc16ee9e02d1deaRichard Smith
19c2d775714f79af977672e4f1dbc16ee9e02d1deaRichard Smithstruct S2 {
20c2d775714f79af977672e4f1dbc16ee9e02d1deaRichard Smith  operator S3();
21c2d775714f79af977672e4f1dbc16ee9e02d1deaRichard Smith};
22c2d775714f79af977672e4f1dbc16ee9e02d1deaRichard Smith
23a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainarnamespace vars {
24a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  constexpr int f() { return 0; }
25a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  struct X { constexpr X() {} };
26a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  namespace v1 { const int DND = 0; }
27a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  namespace v2 { constexpr int DND = f(); }
28a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  namespace v3 { static X DND; }
29a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  namespace v4 { constexpr X DND = {}; }
30a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar}
31a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar
32cd03f862d82cac28c9517e2036716f8d49112c8bRichard Smith#elif !defined(HEADER2)
33cd03f862d82cac28c9517e2036716f8d49112c8bRichard Smith#define HEADER2
34cd03f862d82cac28c9517e2036716f8d49112c8bRichard Smith
35cd03f862d82cac28c9517e2036716f8d49112c8bRichard Smith// Chained PCH.
36c2d775714f79af977672e4f1dbc16ee9e02d1deaRichard SmithS1 *s1;
37c2d775714f79af977672e4f1dbc16ee9e02d1deaRichard SmithS2 *s2;
38eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis
39eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis#else
40cd03f862d82cac28c9517e2036716f8d49112c8bRichard Smith
41cd03f862d82cac28c9517e2036716f8d49112c8bRichard Smith// Using the headers.
42eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis
43c2d775714f79af977672e4f1dbc16ee9e02d1deaRichard Smithvoid test(S1*, S2*) {
44eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis}
45eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis
46eb5e9986e577b1e2bff3cca5973a2494fb593fbbArgyrios Kyrtzidis#endif
47