summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/eh25.C
blob: fb492f78a39f4a0c00c80f3ff7c4d5dcdeb90a59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
// { dg-options "-fexceptions" }

#include <exception>
#include <stdlib.h>

void my_terminate() {
  exit (0);		// Double faults should call terminate
}

struct A {
  A() { }
  ~A() {
    std::set_terminate (my_terminate);
    throw 1;		// This throws from EH dtor, should call my_terminate
  }
};

main() {
  try {
    try {
      throw 1;
    } catch (int i) {
      A a;		// A hit on this EH dtor went to the wrong place
      throw 1;
    }
  } catch (...) {
    return 1;
  }
  return 1;
}