summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/eh3.C
blob: 0cd9cac5fce099f25aaaaf6f09878ec2bd4281f4 (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
// PR target/18841
// { dg-do run }
// { dg-options "-O2" }

extern "C" void abort ();

int r, i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5;

struct S
{
  ~S() { r = i1 + i2 + i3 + i4 + i5; }
};

void foo()
{
  S s;
  throw 1;
}

void bar()
{
  try {
    foo();
  } catch (...) {
  }
}

int main()
{
  bar();
  if (r != 1 + 2 + 3 + 4 + 5)
    abort ();
}