https://issues.dlang.org/show_bug.cgi?id=23639
Issue ID: 23639
Summary: Casting to shared not allowed with
-preview=nosharedaccess
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: blocker
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Consider the following code:
class T {}
shared(T) allocClassMem()
{
void *p;
// assume p is allocated here
return cast(shared(T))p;
}
This yields: Error: direct access to shared `cast(shared(T))p` is not allowed,
see `core.atomic`
How is one supposed to allocate shared memory if casting is not allowed?
--