view gcc/testsuite/g++.dg/init/value10.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +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;
}