MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail22118.d
blobbd34c56ebcc5758e978a00702dc6f4c63d41fd6b
1 // https://issues.dlang.org/show_bug.cgi?id=22118
3 /*
4 TEST_OUTPUT:
5 ---
6 fail_compilation/fail22118.d(33): Error: cannot modify `this.v.a` in `const` function
7 ---
8 */
10 struct NeedsInit
12 int n;
13 @disable this();
16 union U
18 NeedsInit a;
21 struct V
23 NeedsInit a;
26 struct S
28 U u;
29 V v;
30 this(const NeedsInit arg) const
32 u.a = arg; // this should compile
33 v.a = arg; // this should not