2018-10-23 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / pr45605.C
blobfc4d43b01623709aa225b1341099c164246d988d
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-fre1" } */
3 extern "C" void abort(); 
4 bool destructor_called = false; 
6 struct B { 
7     virtual void Run(){}; 
8 }; 
10 struct D : public B { 
11     virtual void Run() 
12       { 
13         struct O { 
14             ~O() { destructor_called = true; }; 
15         } o; 
17         struct Raiser { 
18             Raiser()
19 #if __cplusplus <= 201402L
20             throw( int )                        // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
21 #endif
22             {throw 1;}; 
23         } raiser; 
24       }; 
25 }; 
27 int main() { 
28     try { 
29       D d; 
30       static_cast<B&>(d).Run(); 
31     } catch (...) {} 
33     if (!destructor_called) 
34       abort (); 
35
39 /* We should devirtualize call to D::Run */
40 /* { dg-final { scan-tree-dump-times "D::Run \\(" 3 "fre1" } } */