1// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t.1
2// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t.1 -emit-pch %s -o %t.2
3// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t.2 -verify %s
4// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t.2 -emit-llvm-only %s
5// expected-no-diagnostics
6
7#ifndef PHASE1_DONE
8#define PHASE1_DONE
9
10template<int n> int f() noexcept(n % 2) { return 0; }
11template<int n> int g() noexcept(n % 2);
12
13decltype(f<2>()) f0;
14decltype(f<3>()) f1;
15template int f<4>();
16template int f<5>();
17decltype(f<6>()) f6;
18decltype(f<7>()) f7;
19
20struct A {
21  A();
22  A(const A&);
23};
24
25decltype(g<0>()) g0;
26
27#elif !defined(PHASE2_DONE)
28#define PHASE2_DONE
29
30template int f<6>();
31template int f<7>();
32decltype(f<8>()) f8;
33decltype(f<9>()) f9;
34template int f<10>();
35template int f<11>();
36
37A::A() = default;
38A::A(const A&) = default;
39
40int g0val = g<0>();
41
42#else
43
44static_assert(!noexcept(f<0>()), "");
45static_assert(noexcept(f<1>()), "");
46
47#endif
48