Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 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 | |
| 10 | template<int n> int f() noexcept(n % 2) { return 0; } |
| 11 | template<int n> int g() noexcept(n % 2); |
| 12 | |
| 13 | decltype(f<2>()) f0; |
| 14 | decltype(f<3>()) f1; |
| 15 | template int f<4>(); |
| 16 | template int f<5>(); |
| 17 | decltype(f<6>()) f6; |
| 18 | decltype(f<7>()) f7; |
| 19 | |
| 20 | struct A { |
| 21 | A(); |
| 22 | A(const A&); |
| 23 | }; |
| 24 | |
| 25 | decltype(g<0>()) g0; |
| 26 | |
| 27 | #elif !defined(PHASE2_DONE) |
| 28 | #define PHASE2_DONE |
| 29 | |
| 30 | template int f<6>(); |
| 31 | template int f<7>(); |
| 32 | decltype(f<8>()) f8; |
| 33 | decltype(f<9>()) f9; |
| 34 | template int f<10>(); |
| 35 | template int f<11>(); |
| 36 | |
| 37 | A::A() = default; |
| 38 | A::A(const A&) = default; |
| 39 | |
| 40 | int g0val = g<0>(); |
| 41 | |
| 42 | #else |
| 43 | |
| 44 | static_assert(!noexcept(f<0>()), ""); |
| 45 | static_assert(noexcept(f<1>()), ""); |
| 46 | |
| 47 | #endif |