summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/test21443.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gdc.test/fail_compilation/test21443.d')
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test21443.d21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21443.d b/gcc/testsuite/gdc.test/fail_compilation/test21443.d
new file mode 100644
index 00000000000..2d99524da35
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test21443.d
@@ -0,0 +1,21 @@
+// https://issues.dlang.org/show_bug.cgi?id=21443
+// REQUIRED_ARGS: -de
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test21443.d(14): Deprecation: `return` statements cannot be in `scope(failure)` bodies.
+fail_compilation/test21443.d(14): Use try-catch blocks for this purpose
+---
+*/
+
+ulong get () @safe nothrow
+{
+ scope (failure) return 10;
+ throw new Error("");
+}
+
+void main () @safe
+{
+ assert(get() == 10); // passes
+}