initialization immutable array
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 15 11:53:06 PDT 2014
On Thu, 15 May 2014 14:18:03 -0400, AntonSotov <nepuvive at rainmail.biz>
wrote:
> On Thursday, 15 May 2014 at 17:15:50 UTC, Steven Schveighoffer wrote:
>> Assign _items only once in the constructor.
>> immutable(int)[] tmp;
>> foreach(i; 1..4)
>> tmp ~= i;
>> _items = tmp;
>
> thanks for example!
>
> On Thursday, 15 May 2014 at 17:15:50 UTC, Steven Schveighoffer wrote:
>> This should not work IMO.
>
> My second example compiles successfully and displays the correct result
> - that's why I became interested in why it works.
> you can compile yourself.
I didn't speak clearly, I understand that it currently "works", but that
is a bug. It shouldn't work.
-Steve
More information about the Digitalmars-d
mailing list