aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr91355.C
blob: 7a385dc5bdd0513f5567724d2183cc63c1523407 (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
// PR tree-optimization/91355
// { dg-do run }
// { dg-options "-std=c++14" }

unsigned int d = 0;

struct S {
  S () { d++; }
  S (const S &) { d++; }
  ~S () { d--; }
};

void
foo (int i) throw (int) // { dg-warning "dynamic exception specifications are deprecated" }
{
  if (i == 0)
    throw 3;
  S d;
  throw 3;
}

int
main ()
{
  try { foo (1); } catch (...) {}
  if (d)
    __builtin_abort ();
}