Debian Codegraph @

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

raw
1 // PR c++/411
2
3 // Test that a fully-constructed base is destroyed before transferring
4 // control to the handler of a function-try-block.
5
6 // { dg-do run }
7
8 int ad;
9 int r;
10
11 struct A {
12 ~A() { ++ad; }
13 };
14
15 struct B: public A {
16 ~B();
17 };
18
19 B::~B ()
20 try
21 {
22 throw 1;
23 }
24 catch (...)
25 {
26 if (!ad)
27 r = 1;
28 return;
29 }
30
31 int main ()
32 {
33 { B b; }
34 return r;
35 }