52754b5335930e79b956aababdc91bd41e56f8bd
[platform/upstream/gcc.git] / gcc / testsuite / g++.old-deja / g++.mike / eh25.C
1 // Special g++ Options: -fexceptions
2 // excess errors test - XFAIL a29k-*-* sparc64-*-elf sh-*-* arm-*-pe**-*
3
4 #include <exception>
5
6 void my_terminate() {
7   exit (0);             // Double faults should call terminate
8 }
9
10 struct A {
11   A() { }
12   ~A() {
13     std::set_terminate (my_terminate);
14     throw 1;            // This throws from EH dtor, should call my_terminate
15   }
16 };
17
18 main() {
19   try {
20     try {
21       throw 1;
22     } catch (int i) {
23       A a;              // A hit on this EH dtor went to the wrong place
24       throw 1;
25     }
26   } catch (...) {
27     return 1;
28   }
29   return 1;
30 }