summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/value10.C
blob: 2066410a01d03eb6e7905253690dabf7a99588a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// 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;
}