view gcc/testsuite/g++.dg/opt/vt4.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR c++/50243
// { dg-do compile }
// { dg-options "-O" }
// { dg-add-options bind_pic_locally }
// { dg-final { scan-assembler-not "_ZTV.A" } }

void foo ();

struct A
{
  ~A () { }
  virtual void a () = 0;
  virtual void b () = 0;
  virtual void c () = 0;
};

struct B : public A
{
  ~B () { foo (); }
  void a () { foo (); }
  void b () { foo (); }
  void c () { delete this; }
};

void
test ()
{
  A *y = new B ();
  y->a ();
  y->b ();
  y->c ();
}