Debian Codegraph @

gcc/testsuite/g++.dg/eh/delegating1.C

raw
1 // PR c++/103711
2 // { dg-do run { target c++11 } }
3
4 int constructions = 0;
5 int destructions = 0;
6
7 struct A
8 {
9 A() { constructions++; }
10 virtual ~A() { destructions++; }
11 };
12
13 struct B : public virtual A
14 {
15 B(int) { }
16 B() : B(1) { throw -1; }
17 virtual ~B() = default;
18 };
19
20 struct C : public B { };
21
22 int main() {
23 try {
24 C c;
25 }
26 catch (int) {}
27 return (constructions - destructions);
28 }