D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6513 - More info in Range violation exception message?
Summary: More info in Range violation exception message?
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P4 enhancement
Assignee: No Owner
URL:
Keywords: diagnostic
: 10696 11841 (view as issue list)
Depends on:
Blocks:
 
Reported: 2011-08-16 13:56 UTC by bearophile_hugs
Modified: 2024-12-13 17:56 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-08-16 13:56:45 UTC
This is a wrong D2 program:

void main() {
    auto foo = new int[][](10, 10);
    int i = 2;
    foo[i][$ + 1] = 1;
}



It gives at run-time:

core.exception.RangeError@test(4): Range violation


But if possible I'd like a more decriptive message, that gives more information, something like:

core.exception.RangeError@test(4): Range violation (array 'foo[2]', length=10, index=11)

(The disadvantage of this error message is that the binary gets larger in nonrelease mode. If this is too much overhead, then consider a similar message in -debug compilation only).
Comment 1 Andrej Mitrovic 2014-04-25 18:41:24 UTC
*** Issue 11841 has been marked as a duplicate of this issue. ***
Comment 2 Andrej Mitrovic 2014-04-25 18:41:27 UTC
*** Issue 10696 has been marked as a duplicate of this issue. ***
Comment 3 dlangBugzillaToGithub 2024-12-13 17:56:04 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18362

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB