1 // PR 14535 2 // { dg-do run } 3 // { dg-options "-O -finline" } 4 // 5 // Original test case failure required that Raiser constructor be inlined. 6 7 extern "C" void abort(); 8 bool destructor_called = false; 9 10 struct B { 11 virtual void Run(){}; 12 }; 13 14 struct D : public B { 15 virtual void Run() 16 { 17 struct O { 18 ~O() { destructor_called = true; }; 19 } o; 20 21 struct Raiser { 22 Raiser() throw( int ) {throw 1;}; 23 } raiser; 24 }; 25 }; 26 27 int main() { 28 try { 29 D d; 30 static_cast<B&>(d).Run(); 31 } catch (...) {} 32 33 if (!destructor_called) 34 abort (); 35 } 36