Bug 3911 – Associative array in CTFE crashes compiler

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-03-09T02:26:00Z
Last change time
2014-02-15T02:42:55Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-03-09T02:26:43Z
This crashes the compiler: auto bunch(T)(T[] items...) { return ["+" : 0]; } enum int* r = "+" in bunch(1); void main() {} The following variant of the same program doesn't crash the compiler, but gives a forward reference error, that seems wrong: Error: forward reference to bunch auto bunch() { return ["+" : 0]; } enum int* r = "+" in bunch(); void main() {}
Comment #1 by clugdbug — 2010-03-29T21:04:14Z
This fixes the ICE: expression.c line 7181. ---- if (!type) { error("forward reference to inferred return type of function call %s", toChars()); type = Type::terror; + return new ErrorExp(); }
Comment #2 by clugdbug — 2010-03-29T21:05:56Z
*** Issue 4012 has been marked as a duplicate of this issue. ***
Comment #3 by bugzilla — 2010-04-01T14:53:37Z
changeset 430
Comment #4 by bearophile_hugs — 2010-04-09T10:29:36Z
This bug was about two different problems, one of them is now fixed. So I close this bug and move a simplified version of the code that generates the error in bug 4075.