synchronized class C {
private int i;
}
public void foo(C c) {
c.i++;
}
$ dmd -vasm -c old/syncclass.d
_D9syncclass3fooFCQq1CZv:
0000: FF 40 08 inc dword ptr 8[EAX]
0003: C3 ret
foo just incremented `c.i` without locking `c`. Field access should probably be an error outside a `synchronized (c)` statement, unless `c` is `shared`.
Comment #1 by robert.schadek — 2024-12-13T19:23:18Z