summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/init7.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/init7.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/init7.C31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/init7.C b/gcc/testsuite/g++.old-deja/g++.other/init7.C
new file mode 100644
index 000000000..e6c7dc151
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/init7.C
@@ -0,0 +1,31 @@
+// { dg-do run }
+// 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
+
+extern "C" void abort ();
+
+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();
+}