[Issue 23709] Cannot use synchronized on shared class with -preview=nosharedaccess

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 15 13:52:24 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23709

--- Comment #5 from Atila Neves <atila.neves at gmail.com> ---
This is actually two bugs: creating a shared instance isn't possible with new,
but the bug description is still accurate since this doesn't compile:


class Class {}
void main() {
    shared Class c;
    synchronized(c) {}
}

% d.d(4): Error: direct access to shared `c` is not allowed, see `core.atomic`

--


More information about the Digitalmars-d-bugs mailing list