Bug 7434 – Error involving array literal created in ctfe gives wrong line number

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-03T23:02:00Z
Last change time
2015-06-09T05:10:38Z
Keywords
diagnostic
Assigned to
clugdbug
Creator
yebblies

Comments

Comment #0 by yebblies — 2012-02-03T23:02:53Z
Comment #1 by yebblies — 2012-02-03T23:03:18Z
int[string] initHash(in string[] words) { int[string] h; for (auto i=0; i < words.length; i++) { h[words[i]] = i; // Compiler points to this line and says: //Error: non-constant expression ["abc":0,"def":1,"ghi":2] } return h; } int[string] hash3 = initHash(["abc", "def", "ghi"]);
Comment #2 by yebblies — 2012-02-03T23:18:54Z
I can't see how to do this, but I assume there's a clean way to trace back to the CallExp that's being interpreted and use that's Loc.
Comment #3 by yebblies — 2012-02-03T23:25:41Z
Actually never mind, this is the same thing as 3812, and the patch there fixes it. *** This issue has been marked as a duplicate of issue 3812 ***