Is this a bug in dmd 2.067 for struct initializers?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 23 21:57:24 PST 2015


On Sunday, February 22, 2015 17:45:48 Ali Çehreli via Digitalmars-d-learn wrote:
> On 02/22/2015 03:17 PM, Martin Nowak wrote:
> > On Thursday, 19 February 2015 at 22:07:55 UTC, stewarth wrote:
> >> I've gone with "static this()" approach and it works.
> >
> > You should use shared static this to initialize immutable variables.
>
> Is that because they are not thread-local? If so, initializing the same
> variable in multiple 'static this()' blocks would indeed be a race
> condition. Very important...

Yeah. It really should be illegal to initialize immutable variables in
non-shared static constructors.

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

- Jonathan M Davis




More information about the Digitalmars-d-learn mailing list