summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d')
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d b/gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d
new file mode 100644
index 00000000000..59248a969c4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d
@@ -0,0 +1,21 @@
+/+
+TEST_OUTPUT:
+---
+fail_compilation/must_use_opunary.d(20): Error: ignored value of `@mustuse` type `must_use_opunary.S`; prepend a `cast(void)` if intentional
+---
++/
+import core.attribute;
+
+@mustuse struct S
+{
+ ref S opUnary(string op)() return
+ {
+ return this;
+ }
+}
+
+void test()
+{
+ S s;
+ -s;
+}