Debian Codegraph @

gcc/testsuite/g++.dg/tree-ssa/pr45605.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-fre1" } */
3 extern "C" void abort();
4 bool destructor_called = false;
5
6 struct B {
7 virtual void Run(){};
8 };
9
10 struct D : public B {
11 virtual void Run()
12 {
13 struct O {
14 ~O() { destructor_called = true; };
15 } o;
16
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 };
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
37
38
39 /* We should devirtualize call to D::Run */
40 /* { dg-final { scan-tree-dump-times "D::Run \\(" 3 "fre1" } } */