view gcc/testsuite/g++.dg/ipa/devirt-30.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

// PR c++/58678
// { dg-do compile }
// { 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" } }