gcc/testsuite/g++.dg/eh/uncaught4.C
raw| 1 | // PR c++/41174 |
| 2 | // { dg-do run } |
| 3 | // { dg-options "-Wno-deprecated" } |
| 4 | |
| 5 | #include <exception> |
| 6 | |
| 7 | #define assert(E) if (!(E)) __builtin_abort(); |
| 8 | |
| 9 | struct e { |
| 10 | e() |
| 11 | { |
| 12 | assert( !std::uncaught_exception() ); |
| 13 | try { |
| 14 | throw 1; |
| 15 | } catch (int i) { |
| 16 | assert( !std::uncaught_exception() ); |
| 17 | throw; |
| 18 | } |
| 19 | } |
| 20 | }; |
| 21 | |
| 22 | int main() |
| 23 | { |
| 24 | try { |
| 25 | throw e(); |
| 26 | } catch (int i) { |
| 27 | assert( !std::uncaught_exception() ); |
| 28 | } |
| 29 | assert( !std::uncaught_exception() ); |
| 30 | } |