summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ipa/devirt-30.C
blob: 15e85975dcdfc9ccc30d43995ddc71455e67645a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// PR c++/58678
// { dg-options "-O3 -fdump-ipa-devirt" }

// We shouldn't speculatively devirtualize to ~B because B is an abstract
// class; any actual object passed to f will be of some derived class which
// has its own destructor.

struct A
{
  virtual void f() = 0;
  virtual ~A();
};

struct B : A
{
  virtual ~B() {}
};

void f(B* b)
{
  delete b;
}

// { dg-final { scan-ipa-dump-not "Speculatively devirtualizing" "devirt" } }