gcc/testsuite/g++.old-deja/g++.mike/eh41.C
raw| 1 | // { dg-do run { xfail sparc64-*-elf arm-*-pe } } |
| 2 | // { dg-options "-fexceptions" } |
| 3 | |
| 4 | int fail = 0; |
| 5 | |
| 6 | struct A { |
| 7 | A () { a = 'a'; b = 'b'; c = 'c'; } |
| 8 | ~ A () { |
| 9 | if ( a != 'a' ) fail = 1; |
| 10 | if ( b != 'b' ) fail = 1; |
| 11 | if ( c != 'c' ) fail = 1; |
| 12 | } |
| 13 | char a, b, c; |
| 14 | }; |
| 15 | |
| 16 | void some_init () { throw 1; } |
| 17 | |
| 18 | struct C : A { |
| 19 | C () { some_init (); } |
| 20 | }; |
| 21 | |
| 22 | int main () { |
| 23 | try { |
| 24 | C c; |
| 25 | } catch (int i) { |
| 26 | return 0; |
| 27 | } |
| 28 | return 1; |
| 29 | } |