| 1 |
// { dg-do run } |
| 2 |
// simplified from testcase in Windows Developer Journal, |
| 3 |
// submitted by [email protected] |
| 4 |
|
| 5 |
// The initialization of a static local variable must be retried if a |
| 6 |
// previous try finished by throwing an exception [stmt.dcl]/4 |
| 7 |
|
| 8 |
extern "C" void abort (); |
| 9 |
|
| 10 |
struct foo { |
| 11 |
foo() { throw true; } |
| 12 |
}; |
| 13 |
|
| 14 |
void bar() { |
| 15 |
static foo baz; |
| 16 |
} |
| 17 |
|
| 18 |
int main() { |
| 19 |
try { |
| 20 |
bar(); // must throw |
| 21 |
} |
| 22 |
catch (bool) { |
| 23 |
try { |
| 24 |
bar(); // must throw again! |
| 25 |
} |
| 26 |
catch (bool) { |
| 27 |
return 0; |
| 28 |
} |
| 29 |
} |
| 30 |
abort(); |
| 31 |
} |