[Issue 6747] Implicitly allowing objects which contain delegates to be shared/immutable can cause races

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 24 16:25:34 UTC 2021


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

--- Comment #2 from Steven Schveighoffer <schveiguy at gmail.com> ---
The ref is incidental.

Using pointers it compiles:

class Foo
{
   this(int *_i) immutable @safe { dg = (){return _i;}; }
   int* delegate() dg;
}

immutable Foo f;

int notShared;

shared static this()
{
   f = new immutable Foo(&notShared);
}

--


More information about the Digitalmars-d-bugs mailing list