| 1 |
// PR c++/99980 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
#define SA(X) static_assert(X, #X) |
| 5 |
|
| 6 |
struct S { |
| 7 |
template<typename T> |
| 8 |
void f(T) noexcept(B); |
| 9 |
|
| 10 |
struct N { |
| 11 |
template<typename T> |
| 12 |
void f2(T) noexcept(B); |
| 13 |
}; |
| 14 |
|
| 15 |
static constexpr bool B = true; |
| 16 |
}; |
| 17 |
|
| 18 |
S s; |
| 19 |
SA(noexcept(s.f(10))); |
| 20 |
S::N n; |
| 21 |
SA(noexcept(n.f2(10))); |
| 22 |
|
| 23 |
struct Bad { |
| 24 |
template<typename T> |
| 25 |
using U = void() noexcept(B); // { dg-error "not declared" } |
| 26 |
|
| 27 |
template<typename T> |
| 28 |
friend void friendo() noexcept(B); // { dg-error "not declared" } |
| 29 |
|
| 30 |
static constexpr bool B = true; |
| 31 |
}; |