Static foreach pull request

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Wed May 10 11:41:30 PDT 2017


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"
}



More information about the Digitalmars-d mailing list