summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d
blob: 59248a969c4e5e4dae35e1da0bff4b7cee5ccd9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}