www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11841] New: More useful RangeError message

https://d.puremagic.com/issues/show_bug.cgi?id=11841

           Summary: More useful RangeError message
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-12-29 07:12:09 PST ---
Wrong code:


void main() {
    int[10] data;
    int i = 20;
    int j = 30;
    data[i .. j] = 0;
}


DMD 2.065alpha outputs:

core.exception.RangeError temp(5): Range violation


But I'd like an error message like this:

core.exception.RangeError temp(5): Range violation (20..30 is out of 0..10)


(Optional: if you want in -release -noboundscheck mode the first message
without the bounds is enough, to keep the binary more light.)

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 29 2013