aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/eh/partial1.C
blob: db731770c2bfa4f802156778b3181214de2ee303 (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
35
36
37
// PR c++/41449
// { dg-do run }

struct A
{
  A() {}
  A(const A&) { throw 1; }
};

int bs;
struct B
{
  B() { ++bs; }
  B(const B&) { ++bs; }
  ~B() { --bs; }
};

struct C
{
  B b1;
  A a;
  B b2;
};

int main()
{
  {
    B b1, b2;
    A a;

    try {
      C c = { b1, a, b2 };
    } catch (...) {}
  }
  if (bs != 0)
    __builtin_abort ();
}