ctor1.cpp revision 31ad4de047c50cddfc3072be3a82232c53f1ca2d
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 8bool was_f_in_Bar_destroyed=false; 9 10struct Foo 11{ 12 ~Foo() 13 { 14 was_f_in_Bar_destroyed=true; 15 } 16}; 17 18struct Bar 19{ 20 ~Bar() 21 { 22 throw 1; 23 } 24 25 Foo f; 26}; 27 28int 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} 43