view gcc/testsuite/g++.dg/ipa/devirt-14.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* No devirtualization happens here, but A::foo should not end up as reachable
   because the constructor of A is unreachable and therefore the virtual
   method table referring to A::foo is optimized out.  */
/* { dg-do run } */
/* { dg-options "-O2 -fdump-tree-ssa"  } */
class B {
public:
  virtual int foo(void)
{
  return 0;
}
};
namespace {
class A : public B {
public:
  virtual int foo(void)
{
  return 1;
}
};
}
class B a, *b=&a;

int main()
{
  if (0)
    {
    class A a;
    a.foo();
    }
  return b->foo();
}

/* { dg-final { scan-tree-dump-not "A::foo" "ssa"} } */