[Issue 10910] New: Duplicate error messages for array bounds errors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Aug 27 00:05:33 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10910
Summary: Duplicate error messages for array bounds errors
Product: D
Version: D1 & D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: clugdbug at yahoo.com.au
--- Comment #0 from Don <clugdbug at yahoo.com.au> 2013-08-27 00:05:32 PDT ---
The problem is in implicitConvTo() and implicitCastTo(). They call optimize(),
but don't save the result.
optimize() can generate an error message, and return an ErrorExp when an array
bounds error occurs.
It should be called BEFORE implicitConvTo, instead of inside it.
There are many cases of this, here are some examples:
void example()
{
char c = "abcdef"[17];
char[7] x = "abc"[12];
int ww = "abc"["afds"[9]];
}
diag.d(4): Error: string index 17 is out of bounds [0 .. 6]
diag.d(4): Error: string index 17 is out of bounds [0 .. 6]
diag.d(5): Error: string index 12 is out of bounds [0 .. 3]
diag.d(5): Error: string index 12 is out of bounds [0 .. 3]
diag.d(5): Error: string index 12 is out of bounds [0 .. 3]
diag.d(5): Error: string index 12 is out of bounds [0 .. 3]
diag.d(6): Error: string index 9 is out of bounds [0 .. 4]
diag.d(6): Error: string index 9 is out of bounds [0 .. 4]
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list