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 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 9 #define NOEXCEPT_FALSE noexcept (false) 10 #else 11 #define NOEXCEPT_FALSE 12 #endif 13 14 bool was_f_in_Bar_destroyed=false; 15 16 struct Foo 17 { ~FooFoo18 ~Foo() 19 { 20 was_f_in_Bar_destroyed=true; 21 } 22 }; 23 24 struct Bar 25 { ~BarBar26 ~Bar() NOEXCEPT_FALSE 27 { 28 throw 1; 29 } 30 31 Foo f; 32 }; 33 main()34int main() 35 { 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; 48 } 49