Static foreach pull request

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Wed May 10 12:45:38 PDT 2017


On Wednesday, 10 May 2017 at 18:41:30 UTC, Timon Gehr wrote:
> On 10.05.2017 16:21, Stefan Koch wrote:
>> On Wednesday, 10 May 2017 at 14:13:09 UTC, Timon Gehr wrote:
>>> On 10.05.2017 15:18, Stefan Koch wrote:
>>>>
>>>> if you try assert([] is null), it should fail.
>>>
>>> It doesn't. I have tried to make that point before, 
>>> unsuccessfully.
>>> Empty arrays may or may not be null, but the empty array 
>>> literal is
>>> always null.
>> cat t3.d ----
>> static assert([] is null);
>> ---
>> dmd t.d -c ---
>> t3.d(1): Error: static assert  ([] is null) is false
>> ----
>
> void main(){
>     import std.stdio;
>     enum x = [] is null;
>     auto y = [] is null;
>     writeln(x," ",y); // "false true"
> }

Oh fudge.
Another case where the ctfe-engine goes the right way;
And the runtime version does not ... we should fix this one of 
these days.


More information about the Digitalmars-d mailing list