digitalmars.D.bugs - [Issue 4076] New: Wrong error line number with enum
- d-bugmail puremagic.com (31/31) Apr 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4076
- d-bugmail puremagic.com (17/17) May 12 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4076
- d-bugmail puremagic.com (10/10) Feb 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4076
- d-bugmail puremagic.com (21/21) Sep 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4076
- d-bugmail puremagic.com (15/15) Feb 03 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4076
http://d.puremagic.com/issues/show_bug.cgi?id=4076 Summary: Wrong error line number with enum 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 This is wrong D2 code: void main() { enum double n = 10; // ***** // ***** // ***** auto arr = new int[n]; } dmd 2.043 prints: test.d(2): Error: cannot implicitly convert expression (10) of type double to uint Note the line number of the error. It says 2 and not 6. If the enum is far away from the line where arr is defined, it's not easy to understand, find, and fix the bug in the code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 09 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4076 Another test case: enum int N = 10; // line 1 void main() { int[N] arr; arr[N] = 1; // line 4 } dmd v2.045 outputs: test.d(1): Error: array index 10 is out of bounds arr[0 .. 10] test.d(1): Error: array index 10 is out of bounds arr[0 .. 10] The line number of the error is wrong, and there is no need to print it two times. So a better error message can be: test.d(4): Error: array index 10 is out of bounds arr[0 .. 10] -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 12 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4076 Max Samukha <samukha voliacable.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |samukha voliacable.com PST --- *** Issue 5588 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4076 Another test case: import std.typecons; void main() { enum int N = 10; // line 3 // lot of code here... int[Tuple!(int, int)] aa; int x = aa[(1, N)]; } DMD 2.055 gives: test.d(3): Error: cannot implicitly convert expression (10) of type int to Tuple!(int,int) It's not easy to debug such code. The bug is in the line: int x = aa[(1, N)]; Its correct version is: int x = aa[tuple(1, N)]; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4076 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies gmail.com Platform|x86 |All Version|D2 |D1 & D2 Resolution| |WORKSFORME OS/Version|Windows |All This works with the current compiler (1.072 & 2.058) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 03 2012