www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23790] New: Cannot use cas on member variable with

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

          Issue ID: 23790
           Summary: Cannot use cas on member variable with
                    -preview=nosharedaccess
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: atila.neves gmail.com

---------------------
import core.atomic;
struct Argh {
    bool locked;
    void lock() shared {
        while(!cas(&locked, false, true)) { }
    }
}
---------------------

Yields:

d.d(5): Error: direct access to shared `this` is not allowed, see `core.atomic`

--
Mar 17 2023