https://issues.dlang.org/show_bug.cgi?id=19095

Basile B. <b2.t...@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.t...@gmx.com
         Resolution|---                         |INVALID

--- Comment #1 from Basile B. <b2.t...@gmx.com> ---
Not a bug as you say. And this is too different constructs, not related to
static initialization (which means that the title of the report is not correct
btw), see https://dlang.org/spec/declaration.html#NonVoidInitializer

ArrayInitializer

    int[2] ARR = [1];  // "[" -> left square so parse a "ArrayInitializer"

ExpInitializer

    int[2] ARR_2 = foo(); // "f" -> ident char so parse a "ExpInitializer"

ArrayInitializer is useful to make lookup tables, i.e you mostly want the
default value but a particular value for a few cases. This cant be fixed, it's
part of the language and it's used, notably, in the source code of the runtime
for example. It would not be reasonable to force all entries to be initialized.

--

Reply via email to