| 1 |
// Test for checking of exception specifications on defaulted fns |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
struct A |
| 5 |
{ |
| 6 |
A() noexcept = default; |
| 7 |
}; |
| 8 |
|
| 9 |
A a; |
| 10 |
|
| 11 |
struct B |
| 12 |
{ |
| 13 |
B() throw (int) = default; |
| 14 |
}; // { dg-error "dynamic exception specification" "" { target c++17 } .-1 } |
| 15 |
// { dg-warning "deprecated" "" { target { ! c++17 } } .-2 } |
| 16 |
B b; |
| 17 |
|
| 18 |
struct C |
| 19 |
{ |
| 20 |
C() throw (int) { } // { dg-error "dynamic exception specification" "" { target c++17 } } |
| 21 |
}; // { dg-warning "deprecated" "" { target { ! c++17 } } .-1 } |
| 22 |
|
| 23 |
C c; |
| 24 |
|
| 25 |
struct D: C |
| 26 |
{ |
| 27 |
D() throw (int) = default; // { dg-error "dynamic exception specification" "" { target c++17 } } |
| 28 |
}; // { dg-warning "deprecated" "" { target { ! c++17 } } .-1 } |
| 29 |
|
| 30 |
D d; |
| 31 |
|
| 32 |
struct E |
| 33 |
{ |
| 34 |
E() = default; |
| 35 |
}; |
| 36 |
|
| 37 |
E e; |