Bug 4066 – ICE(e2ir.c): enum AA get

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-04-05T05:44:00Z
Last change time
2015-06-09T05:11:58Z
Keywords
ice
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-04-05T05:44:14Z
void main() { enum int[string] aa = ["aa":1, "bb":2]; string s = "xx"; int r = aa.get(s, -1); } dmd 2.042 gives: Internal error: e2ir.c 4600 The error vanishes if aa is not an enum.
Comment #1 by clugdbug — 2010-04-06T06:34:05Z
This shouldn't compile. Because aa is an enum, it doesn't exist at runtime.
Comment #2 by denis.spir — 2010-11-28T10:04:51Z
A use case, where issue happens with 'static' instead of 'enum: enum string[string] escapeCodes = ["\n":"\\n", "\t":"\\t"]; // and many more string escape(string s0) { auto s1 = s0; foreach (c,s ; escapeCodes) s1 = s1.replace(c,s); return s1; } ==> Internal error: e2ir.c 4629 Only tried to use this because it seems impossible to have a func-static AA: __trials__.d(16): Error: non-constant expression ["\x0a":"\\n","\x09":"\\t"] Denis
Comment #3 by andrej.mitrovich — 2012-10-21T13:20:09Z
Both of these seem to work now. Ok to close?
Comment #4 by bearophile_hugs — 2012-10-21T13:52:57Z
Closed.