2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / eh / spec7.C
blob8a1683dbc9d21cc225403df1e4cc9da558a14c65
1 // PR 14535
2 // { dg-do run }
3 // { dg-options "-O -finline" }
4 //
5 // Original test case failure required that Raiser constructor be inlined.
7 extern "C" void abort(); 
8 bool destructor_called = false; 
9  
10 struct B { 
11     virtual void Run(){}; 
12 }; 
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()
23 #if __cplusplus <= 201402L
24             throw( int )                        // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
25 #endif
26             {throw 1;}; 
27         } raiser; 
28       }; 
29 }; 
31 int main() { 
32     try { 
33       D d; 
34       static_cast<B&>(d).Run(); 
35     } catch (...) {} 
37     if (!destructor_called) 
38       abort (); 
39