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