Bug 1343 – Various errors with static initialization of structs and arrays

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2007-07-16T18:36:00Z
Last change time
2014-02-16T15:26:25Z
Keywords
ice-on-valid-code, wrong-code
Assigned to
nobody
Creator
dvdfrdmn

Attachments

IDFilenameSummaryContent-TypeSize
155si1.dTest Case 1text/plain162
156si2.dTest Case 2text/plain210
157si3.dTest Case 3text/plain422

Comments

Comment #0 by dvdfrdmn — 2007-07-16T18:36:31Z
si1.d -- Struct literals do not correctly initialize static arrays in struct declaration. si2.d -- Scalar initializer for static array in struct initializer and struct literals produces too many (and wrong) elements. si3.d -- Structs with zero-length arrays cannot be initialized: dmd: todt.c:146: virtual dt_t* StructInitializer::toDt(): Assertion `sz <= vsz' failed.
Comment #1 by dvdfrdmn — 2007-07-16T18:37:46Z
Created attachment 155 Test Case 1
Comment #2 by dvdfrdmn — 2007-07-16T18:38:22Z
Created attachment 156 Test Case 2
Comment #3 by dvdfrdmn — 2007-07-16T18:39:29Z
Created attachment 157 Test Case 3
Comment #4 by bugzilla — 2009-06-20T21:37:23Z
si3.d: although the compiler shouldn't issue an assert, a zero length array should have a 0 length initializer.
Comment #5 by bugzilla — 2009-07-09T02:45:26Z
Fixed dmd 1.046 and 2.031