Debian Codegraph @

gcc/testsuite/g++.dg/ipa/devirt-30.C

raw
1 // PR c++/58678
2 // { dg-do compile }
3 // { dg-options "-O3 -fdump-ipa-devirt" }
4
5 // We shouldn't speculatively devirtualize to ~B because B is an abstract
6 // class; any actual object passed to f will be of some derived class which
7 // has its own destructor.
8
9 struct A
10 {
11 virtual void f() = 0;
12 virtual ~A();
13 };
14
15 struct B : A
16 {
17 virtual ~B() {}
18 };
19
20 void f(B* b)
21 {
22 delete b;
23 }
24
25 // { dg-final { scan-ipa-dump-not "Speculatively devirtualizing" "devirt" } }