Bug 6317 – ICE on struct literal of nested struct

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-07-14T07:18:00Z
Last change time
2011-07-15T12:25:28Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
bitworld

Comments

Comment #0 by bitworld — 2011-07-14T07:18:58Z
If "struct Relative" is defined at the outer of doTest(), everything is OK. Here are the test codes: ===================================== import std.stdio; void doTest() { struct Relative { int xBase; int xDir; // This method causes a compiler internal error void MoveTo() { } } Relative rel = {1, 2}; } int main(string[] args) { return 0; } =====================================
Comment #1 by yebblies — 2011-07-14T07:44:22Z
This fails for both kinds of struct initializers, Struct(...) and {...}. Workaround is to use a static struct and pass the context as needed. Thanks for reducing this!
Comment #2 by yebblies — 2011-07-14T09:13:52Z
Even simple workaround - use structname(args) instead of { args }. https://github.com/D-Programming-Language/dmd/pull/253
Comment #3 by bugzilla — 2011-07-15T12:25:28Z