* g++.old-deja/g++.other/init7.C: New test: retry initialization
of static locals if first initialization throws
From-SVN: r22901
+1998-10-08 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * g++.old-deja/g++.other/init7.C: New test: retry initialization
+ of static locals if first initialization throws
+
Wed Oct 7 12:00:20 1998 Jim Wilson <wilson@cygnus.com>
* gcc.c-torture/compile/981007-1.c: New test for irix6 -O0 core dump.
--- /dev/null
+// simplified from testcase in Windows Developer Journal,
+// submitted by eyal.ben-david@aks.com
+
+// The initialization of a static local variable must be retried if a
+// previous try finished by throwing an exception [stmt.dcl]/4
+
+// execution test - XFAIL *-*-*
+
+struct foo {
+ foo() { throw true; }
+};
+
+void bar() {
+ static foo baz;
+}
+
+int main() {
+ try {
+ bar(); // must throw
+ }
+ catch (bool) {
+ try {
+ bar(); // must throw again!
+ }
+ catch (bool) {
+ return 0;
+ }
+ }
+ abort();
+}