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