digitalmars.D.bugs - [Issue 4063] New: [CTFE] key not found in AA gives bad error message
- d-bugmail puremagic.com (33/33) Apr 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4063
- d-bugmail puremagic.com (11/11) Jun 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4063
http://d.puremagic.com/issues/show_bug.cgi?id=4063 Summary: [CTFE] key not found in AA gives bad error message Product: D Version: future Platform: x86 OS/Version: Windows Status: NEW Keywords: diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc int foo(string s) { enum int[string] aa = ["aa":1, "bb":2]; return aa[s]; } enum _ = foo("xx"); // line 5 void main() {} dmd 2.042 gives: test.d(5): Error: cannot evaluate foo("xx") at compile time test.d(5): Error: cannot evaluate foo("xx") at compile time A much better pair of error messages can be: test.d(3): Error: Range violation. Key "xx" not found in associative array 'aa'. test.d(5): Error: cannot evaluate foo("xx") at compile time. Or just (if the symmetry with the run-time error is not considered important): test.d(3): key "xx" not found in associative array 'aa'. test.d(5): Error: cannot evaluate foo("xx") at compile time. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4063 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED https://github.com/D-Programming-Language/dmd/commit/0835250480c1458cc868b511da7cd0f757f33029 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2011