gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d
raw| 1 | /+ |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/must_use_opunary.d(20): Error: ignored value of `@mustuse` type `must_use_opunary.S`; prepend a `cast(void)` if intentional |
| 5 | --- |
| 6 | +/ |
| 7 | import core.attribute; |
| 8 | |
| 9 | @mustuse struct S |
| 10 | { |
| 11 | ref S opUnary(string op)() return |
| 12 | { |
| 13 | return this; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | void test() |
| 18 | { |
| 19 | S s; |
| 20 | -s; |
| 21 | } |