digitalmars.D.bugs - [Issue 20195] New: -preview=nosharedaccess has some access problems
- d-bugmail puremagic.com (42/42) Sep 07 2019 https://issues.dlang.org/show_bug.cgi?id=20195
https://issues.dlang.org/show_bug.cgi?id=20195 Issue ID: 20195 Summary: -preview=nosharedaccess has some access problems Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: turkeyman gmail.com I'm trying to build some tooling using `-preview=nosharedaccess`, but there are some edges that are wrong. Try and compile this code: void test() { // shared locals (or struct members) should be able to be initialised: shared int x; // error : direct access to shared `x` is not allowed, see `core.atomic` ref shared(int) fun() { static shared(int) val = void; // init `void` to silence the error noted above // return by reference: return val; // error : direct access to shared `val` is not allowed, see `core.atomic` } ref shared(int) fun2() { static shared(int)* val; // transfer pointer to reference: return *val; // error : direct access to shared `*val` is not allowed, see `core.atomic` } } I think shared things need to be able to initialise, because they can't possibly have been shared around before they were constructed. There just seems to be some problems interacting with ref; I suspect every interaction with ref will yield the same issues. --
Sep 07 2019