[Issue 23790] New: Cannot use cas on member variable with -preview=nosharedaccess

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 17 13:53:10 UTC 2023


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 at puremagic.com
          Reporter: atila.neves at 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`

--


More information about the Digitalmars-d-bugs mailing list