OSDN Git Service

PR c++/53549
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / eh / ctor1.C
1 // { dg-do run }
2
3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 26 Dec 2001 <nathan@nathan@codesourcery.com>
5
6 // PR 411
7
8 bool was_f_in_Bar_destroyed=false;
9
10 struct Foo
11 {
12   ~Foo()
13   {
14     was_f_in_Bar_destroyed=true;
15   }
16 };
17
18 struct Bar
19 {
20   ~Bar()
21   {
22     throw 1;
23   }
24   
25   Foo f;
26 };
27
28 int main()
29 {
30   try
31     {
32       Bar f; 
33     }
34   catch(int i)
35     {
36       if(was_f_in_Bar_destroyed)
37         {
38           return 0;
39         }
40     }
41   return 1;
42 }