Issue 23790 - Cannot use cas on member variable with -preview=nosharedaccess
Summary: Cannot use cas on member variable with -preview=nosharedaccess
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 blocker
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2023-03-17 13:53 UTC by Atila Neves
Modified: 2023-04-01 22:15 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Atila Neves 2023-03-17 13:53:10 UTC
---------------------
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`
Comment 1 Dlang Bot 2023-03-21 12:50:24 UTC
@RazvanN7 created dlang/dmd pull request #15016 "Fix Issue 23790 - Cannot use cas on member variable with -preview=nosharedaccess" fixing this issue:

- Fix Issue 23790 - Cannot use cas on member variable with -preview=nosharedaccess

https://github.com/dlang/dmd/pull/15016
Comment 2 Dlang Bot 2023-03-22 08:47:39 UTC
dlang/dmd pull request #15016 "Fix Issue 23790 - Cannot use cas on member variable with -preview=nosharedaccess" was merged into stable:

- c9a887f51541d829469636b4eb13dd61cc807924 by RazvanN7:
  Fix Issue 23790 - Cannot use cas on member variable with -preview=nosharedaccess

https://github.com/dlang/dmd/pull/15016
Comment 3 Dlang Bot 2023-04-01 22:15:14 UTC
dlang/dmd pull request #15066 "merge stable" was merged into master:

- 270845e4263b3043c444bbb3ba22d375493bf88e by Razvan Nitu:
  Fix Issue 23790 - Cannot use cas on member variable with -preview=nosharedaccess (#15016)

https://github.com/dlang/dmd/pull/15066