gcc/testsuite/g++.old-deja/g++.eh/inline2.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-options "-O" } |
| 3 | // Test that inlining a destructor with a catch block doesn't confuse the |
| 4 | // enclosing try block. |
| 5 | |
| 6 | struct A { |
| 7 | ~A() |
| 8 | { |
| 9 | try { throw 1; } |
| 10 | catch (...) { } |
| 11 | } |
| 12 | }; |
| 13 | |
| 14 | int main () |
| 15 | { |
| 16 | try |
| 17 | { |
| 18 | A a; |
| 19 | throw 42; |
| 20 | } |
| 21 | catch (int i) |
| 22 | { |
| 23 | return (i != 42); |
| 24 | } |
| 25 | } |