https://issues.dlang.org/show_bug.cgi?id=23158
Issue ID: 23158 Summary: synchronized class data is not locked in free function in same module Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: n...@geany.org 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`. --