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 { RunB11 virtual void Run(){}; 12 }; 13 14 struct D : public B { RunD15 virtual void Run() 16 { 17 struct O { 18 ~O() { destructor_called = true; }; 19 } o; 20 21 struct Raiser { 22 Raiser() 23 #if __cplusplus <= 201402L 24 throw( int ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } } 25 #endif 26 {throw 1;}; 27 } raiser; 28 }; 29 }; 30 main()31int main() { 32 try { 33 D d; 34 static_cast<B&>(d).Run(); 35 } catch (...) {} 36 37 if (!destructor_called) 38 abort (); 39 } 40