| 1 |
// { dg-do run } |
| 2 |
// Copyright (C) 1999 Free Software Foundation |
| 3 |
|
| 4 |
// by Alexandre Oliva <[email protected]> |
| 5 |
|
| 6 |
// Test whether dtors of vbases are called on throw within new[]. |
| 7 |
// Variant of delete2.C. |
| 8 |
|
| 9 |
extern "C" void abort(); |
| 10 |
extern "C" void exit(int); |
| 11 |
|
| 12 |
struct 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 |
|
| 27 |
bool Foo::first = true; |
| 28 |
|
| 29 |
struct Bar : virtual Foo { |
| 30 |
}; |
| 31 |
|
| 32 |
int main() { |
| 33 |
try { |
| 34 |
delete [] new Bar[2]; |
| 35 |
} catch (...) { |
| 36 |
} |
| 37 |
abort(); |
| 38 |
} |