1 /* 2 TEST_OUTPUT: 3 --- 4 fail_compilation/fail3672.d(28): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(*p, 1) instead. 5 fail_compilation/fail3672.d(32): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(*sfp, 1) instead. 6 fail_compilation/fail3672.d(32): Error: '*sfp += 1' is not a scalar, it is a shared(SF) 7 --- 8 */ 9 10 struct SF // should fail 11 { opOpAssignSF12 void opOpAssign(string op, T)(T rhs) 13 { 14 } 15 } 16 17 struct SK // ok 18 { opOpAssign(string op,T)19 void opOpAssign(string op, T)(T rhs) shared 20 { 21 } 22 } 23 main()24void main() 25 { 26 shared int x; 27 auto p = &x; 28 *p += 1; // fail 29 30 shared SF sf; 31 auto sfp = &sf; 32 *sfp += 1; // fail 33 34 shared SK sk; 35 auto skp = &sk; 36 sk += 1; // ok 37 *skp += 1; // ok 38 } 39