1343 – Various errors with static initialization of structs and arrays

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1343 - Various errors with static initialization of structs and arrays
Summary: Various errors with static initialization of structs and arrays
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: ice-on-valid-code, wrong-code
Depends on:
Blocks:
Reported: 2007年07月16日 18:36 UTC by David Friedman
Modified: 2014年02月16日 15:26 UTC (History)
1 user (show)

See Also:


Attachments
Test Case 1 (162 bytes, text/plain)
2007年07月16日 18:37 UTC, David Friedman
Details
Test Case 2 (210 bytes, text/plain)
2007年07月16日 18:38 UTC, David Friedman
Details
Test Case 3 (422 bytes, text/plain)
2007年07月16日 18:39 UTC, David Friedman
Details
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
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 によって変換されたページ (->オリジナル) /