summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/goto3.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gdc.test/fail_compilation/goto3.d')
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/goto3.d37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/goto3.d b/gcc/testsuite/gdc.test/fail_compilation/goto3.d
new file mode 100644
index 00000000000..4b811fa898a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/goto3.d
@@ -0,0 +1,37 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/goto3.d(1010): Error: case cannot be in different `try` block level from `switch`
+fail_compilation/goto3.d(1012): Error: default cannot be in different `try` block level from `switch`
+---
+ */
+
+
+void foo();
+void bar();
+
+#line 1000
+
+void test1()
+{
+ int i;
+ switch (i)
+ {
+ case 1:
+ try
+ {
+ foo();
+ case 2:
+ { }
+ default:
+ { }
+ }
+ finally
+ {
+ bar();
+ }
+ break;
+ }
+}
+
+