view gcc/testsuite/g++.dg/init/value10.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++/51331
// { dg-do run }

struct A {
  A(): x(10) {}
  virtual ~A() {}

  int x;
};

struct B: public virtual A {
};

struct C: public virtual A {
};

struct D: public B, virtual public C {
  D(): B(), C() {}  // note an explicit call to C() which is auto-generated
};

int main() {
  D* d = new D();

  // Crashes here with the following message:
  // *** glibc detected *** ./test: free(): invalid next size (fast)
  delete d;
}