gcc/testsuite/g++.dg/warn/Wterminate1.C
raw| 1 | // In C++98 mode this gets a -Wc++11-compat warning, in C++11 mode a |
| 2 | // -Wterminate warning. |
| 3 | |
| 4 | // Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'. |
| 5 | // { dg-options "-Wall" } |
| 6 | |
| 7 | struct A |
| 8 | { |
| 9 | ~A() |
| 10 | { |
| 11 | throw 1; // { dg-warning "terminate" } |
| 12 | } |
| 13 | }; |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | try { A a; } |
| 18 | catch (...) {} |
| 19 | } |
| 20 | |
| 21 |