1// { dg-do run  }
2// Copyright (C) 1999 Free Software Foundation
3
4// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
5
6// Test whether dtors of vbases are called on throw within new[].
7// Variant of delete2.C.
8
9extern "C" void abort();
10extern "C" void exit(int);
11
12struct Foo {
13  static bool first;
14
15  Foo() {
16    if (first)
17      first = false;
18    else
19      throw first;
20  }
21
22  ~Foo() {
23    exit(0);
24  }
25};
26
27bool Foo::first = true;
28
29struct Bar : virtual Foo {
30};
31
32int main() {
33  try {
34    delete [] new Bar[2];
35  } catch (...) {
36  }
37  abort();
38}
39