[Issue 23381] null/init are not accepted as initializers of a zero-sized static array
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Oct  3 11:59:34 UTC 2022
    
    
  
https://issues.dlang.org/show_bug.cgi?id=23381
Nick Treleaven <nick at geany.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick at geany.org
--- Comment #1 from Nick Treleaven <nick at geany.org> ---
>     int[0] a1 = null; // ok
I don't think that should work - a static array is not a reference. Just use
`[]` or init. Especially as there are no compile-time errors when the array
length is > 0 for null, but there are for `[]`:
void f()
{
    int[1] b = []; // error
    int[1] a = null; // no error
    a = []; // error
    a = null; // no error
}
--
    
    
More information about the Digitalmars-d-bugs
mailing list