OSDN Git Service

PR c++/53549
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / eh / filter1.C
1 // Test that cleanups get run when a catch filter fails to match.
2 // { dg-do run }
3
4 extern "C" void exit(int);
5 extern "C" void abort();
6
7 struct a
8 {
9   a();
10   ~a();
11 };
12
13 struct e1 {};
14 struct e2 {};
15
16 void
17 ex_test ()
18 {
19   a aa;
20   try
21     {
22       throw e1 ();
23     }
24   catch (e2 &)
25     {
26     }
27 }
28
29 int
30 main ()
31 {
32   try
33     {
34       ex_test ();
35     }
36   catch (...)
37     {
38     }
39   abort ();
40 }
41
42 a::a() { }
43 a::~a() { exit (0); }