MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail3672.d
blob2f9bdf742b7e350451e84fa51275144d0a58d436
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail3672.d(28): Error: read-modify-write operations are not allowed for `shared` variables
5 fail_compilation/fail3672.d(28): Use `core.atomic.atomicOp!"+="(*p, 1)` instead
6 fail_compilation/fail3672.d(32): Error: none of the `opOpAssign` overloads of `SF` are callable for `*sfp` of type `shared(SF)`
7 ---
8 */
10 struct SF // should fail
12 void opOpAssign(string op, T)(T rhs)
17 struct SK // ok
19 void opOpAssign(string op, T)(T rhs) shared
24 void main()
26 shared int x;
27 auto p = &x;
28 *p += 1; // fail
30 shared SF sf;
31 auto sfp = &sf;
32 *sfp += 1; // fail
34 shared SK sk;
35 auto skp = &sk;
36 sk += 1; // ok
37 *skp += 1; // ok