D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.

Issue 1343

Summary: Various errors with static initialization of structs and arrays
Product: D Reporter: David Friedman <dvdfrdmn>
Component: dmdAssignee: No Owner <nobody>
Status: RESOLVED FIXED
Severity: major CC: bugzilla
Priority: P2 Keywords: ice-on-valid-code, wrong-code
Version: D1 (retired)
Hardware: All
OS: All
Attachments: Test Case 1
Test Case 2
Test Case 3

Description David Friedman 2007年07月16日 18:36:31 UTC
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 David Friedman 2007年07月16日 18:37:46 UTC
Created attachment 155 [details] 
Test Case 1
Comment 2 David Friedman 2007年07月16日 18:38:22 UTC
Created attachment 156 [details] 
Test Case 2
Comment 3 David Friedman 2007年07月16日 18:39:29 UTC
Created attachment 157 [details] 
Test Case 3
Comment 4 Walter Bright 2009年06月20日 21:37:23 UTC
si3.d: although the compiler shouldn't issue an assert, a zero length array should have a 0 length initializer.
Comment 5 Walter Bright 2009年07月09日 02:45:26 UTC
Fixed dmd 1.046 and 2.031

AltStyle によって変換されたページ (->オリジナル) /