dmd
dmd copied to clipboard
Improve static array initializer checks
~Disallow~ Deprecate null literal runtime SA initializer (except as an element initializer when element type accepts null). Rationale in bug below.
Disallow init
as runtime SA initializer when static array length > 0.
Allow init
as initializer for global static array regardless of length.
Fix Issue 23381 - init as initializer of 0-sized static array
This requires a changelog entry.
@ntrel Could you please add a changelog entry?
Allow init as initializer for global static array regardless of length.
Why? I don't understand why this should be legal:
int[1] a3 = (int[]).init; // ok
(int[]).init
is null
. If int[1] a3 = null
is disabled why allow this?
ping @ntrel