← Back to index
|
Original Bugzilla link
Bug 3281 – ICE(cod1.c) append returned struct to array
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-09-02T09:41:00Z
Last change time
2015-06-09T01:28:06Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
peng2cheng2
Comments
Comment #0
by peng2cheng2 — 2009-09-02T09:41:02Z
import std.stdio; struct S {string s; this(string x){s=x;}} immutable(S) mkS(){ return S("mks hi"); } void main(char[][] args) { immutable(S) s = mkS(); immutable(S)[] ss; ss ~= S("plain hi"); ss ~= cast(immutable(S)) S("plain hi"); //ss ~= mkS(); // --> "Internal error: ../ztc/cod1.c 1684" writeln(s.s, ", ", ss[0].s); } I think (hope?) this is all valid code. I.e., ss ~= S("Hi"); //should be ok ss.length = ss.length + 1; ss[$-1] = S("plain hi"); //should fail to compile (as it indeed does) In any case there is an ICE. Error: ss[0] isn't mutable Error: ss[0] isn't mutable //ss[0] = S("fail"); --> Error: ss[0] isn't mutable
Comment #1
by clugdbug — 2009-09-02T12:19:08Z
Good news: This is already fixed in DMD 2.032, which will hopefully be released tomorrow.
Comment #2
by bugzilla — 2009-09-03T13:46:02Z
Fixed dmd 2.032