* gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.mike / eh23.C
blobda2ac0ef39d94c79da314a6b7396491c83c5b663
1 // { dg-do run { xfail sparc64-*-elf arm-*-pe } }
2 // { dg-options "-fexceptions" }
4 #include <exception>
5 #include <stdlib.h>
7 struct double_fault { };
8 int fault_now;
10 class E {
11 public:
12   E() { }
13   E(const E&) {
14     if (fault_now)
15       throw double_fault();
16   }
19 void foo() {
20   try {
21     throw E();
22   } catch (...) {
23     fault_now = 1;
24     throw;
25   }
28 void bar() {
29   try {
30     foo();
31   } catch (E e) {       // double fault here
32   }
35 void my_terminate() {
36   exit (0);             // double faults should call terminate
39 main() {
40   std::set_terminate (my_terminate);
41   try {
42     bar();
43   } catch (...) {
44     return 1;
45   }
46   return 1;