| 1 |
// PR c++/113158 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template<typename T> |
| 5 |
struct V { |
| 6 |
static constexpr bool t = false; |
| 7 |
}; |
| 8 |
struct base { |
| 9 |
virtual int f() = 0; |
| 10 |
}; |
| 11 |
|
| 12 |
template<typename T> |
| 13 |
struct derived : base { |
| 14 |
int f() noexcept(V<T>::t) override; |
| 15 |
}; |
| 16 |
|
| 17 |
struct base2 { |
| 18 |
virtual int f() noexcept = 0; |
| 19 |
}; |
| 20 |
|
| 21 |
template<bool B> |
| 22 |
struct W { |
| 23 |
static constexpr bool t = B; |
| 24 |
}; |
| 25 |
|
| 26 |
template<bool B> |
| 27 |
struct derived2 : base2 { |
| 28 |
int f() noexcept(W<B>::t) override; // { dg-error "looser exception specification" } |
| 29 |
}; |
| 30 |
|
| 31 |
void |
| 32 |
g () |
| 33 |
{ |
| 34 |
derived<int> d1; |
| 35 |
derived2<false> d2; // { dg-message "required from here" } |
| 36 |
derived2<true> d3; |
| 37 |
} |