https://issues.dlang.org/show_bug.cgi?id=17341
Issue ID: 17341
Summary: Partial initialization of static array should not be
allowed
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
In this example:
```
enum E{e0,e1,e2}
static immutable int[E.max + 1] a = [0,1]; // oops no 3rd element
static assert(isStaticArray!(typeof(a))); // no detected
```
we use an enum to define the size of a static array. The ArrayInitializer only
sets the 2 first elements and nothing allows to statically check the omission
(that could happen for example when adding new members to an enum).
Two possible actions:
- The compiler could emit a warning for this case.
- Deprecate "partial initialization of static arrays" and update the
specifications.
--