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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 15 12:14:56 UTC 2023


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
Actually, the issue does not seem to have anything to do with synchronized
(although, looking at the code it seems that Synchronized Statements have their
own issues), but rather that you cannot create shared objects:

class Class {}                                                                  
void main() {
    auto b = new shared Class();   // Error: direct access to shared `new
shared(Class)` is not allowed, see `core.atomic`
}

This is ridiculous, so you can't create shared objects with new?

--


More information about the Digitalmars-d-bugs mailing list