gcc/testsuite/g++.dg/opt/eh2.C
raw| 1 | // PR 6764 |
| 2 | // { dg-do run } |
| 3 | // { dg-options "-O -fomit-frame-pointer" } |
| 4 | |
| 5 | extern "C" void abort (); |
| 6 | |
| 7 | class test |
| 8 | { |
| 9 | public: |
| 10 | test * const me; |
| 11 | test () : me(this) { } |
| 12 | ~test () { if (me != this) abort (); } |
| 13 | }; |
| 14 | |
| 15 | void x1 () |
| 16 | { |
| 17 | test w1; |
| 18 | throw 1; |
| 19 | } |
| 20 | |
| 21 | void x2 () |
| 22 | { |
| 23 | test w2; |
| 24 | x1 (); |
| 25 | } |
| 26 | |
| 27 | int main (void) |
| 28 | { |
| 29 | try { |
| 30 | x2 (); |
| 31 | } catch (...) { |
| 32 | } |
| 33 | return 0; |
| 34 | } |