summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/eh2.C
blob: 7cb49f00cee71719550d0cfae2633a426bf6b05f (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
32
33
34
// PR 6764
// { dg-do run }
// { dg-options "-O -fomit-frame-pointer" }

extern "C" void abort ();

class test
{
 public:
  test * const me;
  test () : me(this) { }
  ~test () { if (me != this) abort (); }
};

void x1 ()
{
  test w1;
  throw 1;
}

void x2 ()
{
  test w2;
  x1 ();
}

int main (void)
{
  try {
    x2 ();
  } catch (...) {
  }
  return 0;
}