[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / g++.dg / eh / ctor1.C
blobb959d1c5620878108ebb20e86bff645bf3ce5ea3
1 // { dg-do run }
3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 26 Dec 2001 <nathan@nathan@codesourcery.com>
6 // PR 411
8 #ifdef __GXX_EXPERIMENTAL_CXX0X__
9 #define NOEXCEPT_FALSE noexcept (false)
10 #else
11 #define NOEXCEPT_FALSE
12 #endif
14 bool was_f_in_Bar_destroyed=false;
16 struct Foo
18   ~Foo()
19   {
20     was_f_in_Bar_destroyed=true;
21   }
24 struct Bar
26   ~Bar() NOEXCEPT_FALSE
27   {
28     throw 1;
29   }
30   
31   Foo f;
34 int main()
36   try
37     {
38       Bar f; 
39     }
40   catch(int i)
41     {
42       if(was_f_in_Bar_destroyed)
43         {
44           return 0;
45         }
46     }
47   return 1;