1 // RUN: %clang_cc1 -pedantic -std=c++1y -include %s -include %s -verify %s
2 // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch -o %t.1 %s
3 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.1 -emit-pch -o %t.2 %s
4 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.2 -verify %s
5 
6 #ifndef HEADER_1
7 #define HEADER_1
8 
9 struct A {
10   int x;
11   int y = 3;
12   int z = x + y;
13 };
14 template<typename T> constexpr A make() { return A {}; }
15 template<typename T> constexpr A make(T t) { return A { t }; }
16 
17 struct B {
18   int z1, z2 = z1;
19   constexpr B(int k) : z1(k) {}
20 };
21 
22 template<typename T> struct C {
23   constexpr C() {}
24   T c = T();
25   struct U {};
26 };
27 // Instantiate C<int> but not the default initializer.
28 C<int>::U ciu;
29 
30 #elif !defined(HEADER_2)
31 #define HEADER_2
32 
33 // Instantiate the default initializer now, should create an update record.
34 C<int> ci;
35 
36 #else
37 
38 static_assert(A{}.z == 3, "");
39 static_assert(A{1}.z == 4, "");
40 static_assert(A{.y = 5}.z == 5, ""); // expected-warning {{C99}}
41 static_assert(A{3, .y = 1}.z == 4, ""); // expected-warning {{C99}}
42 static_assert(make<int>().z == 3, "");
43 static_assert(make<int>(12).z == 15, "");
44 static_assert(C<int>().c == 0, "");
45 
46 #endif
47