| 1 |
// REQUIRED_ARGS: -de |
| 2 |
/* |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
fail_compilation/diag3672.d(8): Error: read-modify-write operations are not allowed for `shared` variables |
| 6 |
fail_compilation/diag3672.d(8): Use `core.atomic.atomicOp!"+="(x, 1)` instead |
| 7 |
fail_compilation/diag3672.d(9): Error: read-modify-write operations are not allowed for `shared` variables |
| 8 |
fail_compilation/diag3672.d(9): Use `core.atomic.atomicOp!"+="(x, 1)` instead |
| 9 |
fail_compilation/diag3672.d(10): Error: read-modify-write operations are not allowed for `shared` variables |
| 10 |
fail_compilation/diag3672.d(10): Use `core.atomic.atomicOp!"-="(x, 1)` instead |
| 11 |
fail_compilation/diag3672.d(11): Error: read-modify-write operations are not allowed for `shared` variables |
| 12 |
fail_compilation/diag3672.d(11): Use `core.atomic.atomicOp!"-="(x, 1)` instead |
| 13 |
fail_compilation/diag3672.d(12): Error: read-modify-write operations are not allowed for `shared` variables |
| 14 |
fail_compilation/diag3672.d(12): Use `core.atomic.atomicOp!"+="(x, 1)` instead |
| 15 |
fail_compilation/diag3672.d(13): Error: read-modify-write operations are not allowed for `shared` variables |
| 16 |
fail_compilation/diag3672.d(13): Use `core.atomic.atomicOp!"+="(x, 2)` instead |
| 17 |
fail_compilation/diag3672.d(14): Error: read-modify-write operations are not allowed for `shared` variables |
| 18 |
fail_compilation/diag3672.d(14): Use `core.atomic.atomicOp!"-="(x, 3)` instead |
| 19 |
fail_compilation/diag3672.d(15): Error: read-modify-write operations are not allowed for `shared` variables |
| 20 |
fail_compilation/diag3672.d(15): Use `core.atomic.atomicOp!"|="(x, y)` instead |
| 21 |
fail_compilation/diag3672.d(16): Error: read-modify-write operations are not allowed for `shared` variables |
| 22 |
fail_compilation/diag3672.d(16): Use `core.atomic.atomicOp!"*="(x, y)` instead |
| 23 |
fail_compilation/diag3672.d(17): Error: read-modify-write operations are not allowed for `shared` variables |
| 24 |
fail_compilation/diag3672.d(17): Use `core.atomic.atomicOp!"/="(x, y)` instead |
| 25 |
fail_compilation/diag3672.d(18): Error: read-modify-write operations are not allowed for `shared` variables |
| 26 |
fail_compilation/diag3672.d(18): Use `core.atomic.atomicOp!"%="(x, y)` instead |
| 27 |
fail_compilation/diag3672.d(19): Error: read-modify-write operations are not allowed for `shared` variables |
| 28 |
fail_compilation/diag3672.d(19): Use `core.atomic.atomicOp!"&="(x, y)` instead |
| 29 |
fail_compilation/diag3672.d(20): Error: read-modify-write operations are not allowed for `shared` variables |
| 30 |
fail_compilation/diag3672.d(20): Use `core.atomic.atomicOp!"^="(x, y)` instead |
| 31 |
fail_compilation/diag3672.d(21): Error: read-modify-write operations are not allowed for `shared` variables |
| 32 |
fail_compilation/diag3672.d(21): Use `core.atomic.atomicOp!"<<="(x, y)` instead |
| 33 |
fail_compilation/diag3672.d(22): Error: read-modify-write operations are not allowed for `shared` variables |
| 34 |
fail_compilation/diag3672.d(22): Use `core.atomic.atomicOp!">>="(x, y)` instead |
| 35 |
fail_compilation/diag3672.d(23): Error: read-modify-write operations are not allowed for `shared` variables |
| 36 |
fail_compilation/diag3672.d(23): Use `core.atomic.atomicOp!">>>="(x, y)` instead |
| 37 |
fail_compilation/diag3672.d(24): Error: read-modify-write operations are not allowed for `shared` variables |
| 38 |
fail_compilation/diag3672.d(24): Use `core.atomic.atomicOp!"^^="(x, y)` instead |
| 39 |
fail_compilation/diag3672.d(25): Error: read-modify-write operations are not allowed for `shared` variables |
| 40 |
fail_compilation/diag3672.d(25): Use `core.atomic.atomicOp!"+="(ptr, 1)` instead |
| 41 |
fail_compilation/diag3672.d(26): Error: read-modify-write operations are not allowed for `shared` variables |
| 42 |
fail_compilation/diag3672.d(26): Use `core.atomic.atomicOp!"+="(ptr, 1)` instead |
| 43 |
fail_compilation/diag3672.d(27): Error: read-modify-write operations are not allowed for `shared` variables |
| 44 |
fail_compilation/diag3672.d(27): Use `core.atomic.atomicOp!"-="(ptr, 1)` instead |
| 45 |
fail_compilation/diag3672.d(28): Error: read-modify-write operations are not allowed for `shared` variables |
| 46 |
fail_compilation/diag3672.d(28): Use `core.atomic.atomicOp!"-="(ptr, 1)` instead |
| 47 |
--- |
| 48 |
*/ |
| 49 |
|
| 50 |
#line 1 |
| 51 |
shared int x; |
| 52 |
shared int y; |
| 53 |
shared int* ptr; |
| 54 |
shared static this() { ptr = new int; } // silence null-dereference errors |
| 55 |
|
| 56 |
void main() |
| 57 |
{ |
| 58 |
++x; |
| 59 |
x++; |
| 60 |
--x; |
| 61 |
x--; |
| 62 |
x += 1; |
| 63 |
x += 2; |
| 64 |
x -= 3; |
| 65 |
x |= y; |
| 66 |
x *= y; |
| 67 |
x /= y; |
| 68 |
x %= y; |
| 69 |
x &= y; |
| 70 |
x ^= y; |
| 71 |
x <<= y; |
| 72 |
x >>= y; |
| 73 |
x >>>= y; |
| 74 |
x ^^= y; |
| 75 |
++ptr; |
| 76 |
ptr++; |
| 77 |
--ptr; |
| 78 |
ptr--; |
| 79 |
} |