summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/test4946.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gdc.test/fail_compilation/test4946.d')
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test4946.d19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test4946.d b/gcc/testsuite/gdc.test/fail_compilation/test4946.d
new file mode 100644
index 00000000000..e19932b0371
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test4946.d
@@ -0,0 +1,19 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/test4946.d(13): Error: 'pure' cannot be placed after a template constraint
+fail_compilation/test4946.d(14): Error: 'const' cannot be placed after a template constraint
+fail_compilation/test4946.d(15): Error: 'immutable' cannot be placed after a template constraint
+fail_compilation/test4946.d(16): Error: 'inout' cannot be placed after a template constraint
+fail_compilation/test4946.d(17): Error: 'shared' cannot be placed after a template constraint
+fail_compilation/test4946.d(18): Error: 'nothrow' cannot be placed after a template constraint
+fail_compilation/test4946.d(19): Error: attributes cannot be placed after a template constraint
+---
+*/
+
+void bar1(int x)() if (x > 0) pure { int a;}
+void bar2(int x)() if (x > 0) const { int a;}
+void bar3(int x)() if (x > 0) immutable { int a;}
+void bar4(int x)() if (x > 0) inout { int a;}
+void bar5(int x)() if (x > 0) shared { int a;}
+void bar6(int x)() if (x > 0) nothrow { int a;}
+void bar7(int x)() if (x > 0) @safe { int a;}