Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / init7.C
blobe6c7dc151f1be15619628dbb61a605338ce8439c
1 // { dg-do run  }
2 // simplified from testcase in Windows Developer Journal,
3 // submitted by eyal.ben-david@aks.com
5 // The initialization of a static local variable must be retried if a
6 // previous try finished by throwing an exception [stmt.dcl]/4
8 extern "C" void abort ();
10 struct foo {
11   foo() { throw true; }
14 void bar() {
15   static foo baz;
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();