ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.19k stars 256 forks source link

Inconsistent behavior with variadic arg array #3140

Open tchaloupka opened 5 years ago

tchaloupka commented 5 years ago

Hi, I've found that this code:

import std.stdio;

void test(ubyte[] args...)
{
    writeln(args ? true : false);
}

void main()
{   
    test();
}

Yelds these results with dmd (tried with run.dlang.org):

Up to      2.066.0: Success with output: true
Since      2.067.1: Success with output: false

But ldc2 outputs true so the argument array !is null

kinke commented 5 years ago

The issue is that we use undef as pointer for the 0-length array.