gcc/testsuite/g++.old-deja/g++.mike/eh38.C
raw| 1 | // { dg-do run { xfail sparc64-*-elf arm-*-pe } } |
| 2 | // { dg-options "-fexceptions" } |
| 3 | |
| 4 | #include <typeinfo> |
| 5 | |
| 6 | class B { |
| 7 | public: |
| 8 | int data; |
| 9 | B(int i) : data(i) { |
| 10 | } |
| 11 | } b(42); |
| 12 | |
| 13 | int |
| 14 | main() { |
| 15 | try { |
| 16 | throw &b; |
| 17 | } catch (const B* bptr) { |
| 18 | if (bptr->data == 42) |
| 19 | { |
| 20 | try { |
| 21 | throw &b; |
| 22 | } catch (void *bptr) { |
| 23 | if (((B*)bptr)->data == 42) |
| 24 | return 0; |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | return 1; |
| 29 | } |