Bug 508 – All members of an array need not be initialised

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P4
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-11-15T05:06:00Z
Last change time
2014-02-15T13:21:02Z
Keywords
spec
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla
Blocks
511

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2006-11-15T05:06:35Z
The spec states "If any members of an array are initialized, they all must be." along with explanation of why this choice was made. Yet, the following code, _from the same section of the spec_, compiles and runs: int[3] a = [ 1:2, 3 ]; // a[0] = 0, a[1] = 2, a[2] = 3 Which is correct? Remove the paragraph from the spec or change compiler behaviour to match, changing the comment in the above to "// fails, a[0] not initialised" or equivalent. This is the first of a number of documentation-related bugs I'll be filing: I'm going to mark them as priority "P4" (defer until next major version) since they need fixing prior to D 1.0.
Comment #1 by matti.niemenmaa+dbugzilla — 2006-11-18T06:04:29Z
Oops...
Comment #2 by smjg — 2006-11-18T07:03:16Z
*** Bug 181 has been marked as a duplicate of this bug. ***
Comment #3 by matti.niemenmaa+dbugzilla — 2006-12-03T03:51:09Z
Spec corrected for DMD 0.176.