[Issue 6329] Out of range exceptions not thrown in certain cases

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 3 20:21:34 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6329



--- Comment #9 from Walter Bright <bugzilla at digitalmars.com> 2012-03-03 20:21:31 PST ---
(In reply to comment #0)
> import std.stdio;
> import std.file;
> void main()
> {
>     foreach (string entry; dirEntries(".", SpanMode.shallow))
>     {
>         writeln(entry[0..1000]);  // out of range
>     }
> }
> DMD 2.053:
> D:\>dmd test.d && test.exe
> core.exception.RangeError at test(8): Range violation
> DMD 2.054:
> D:\>dmd test.d && test.exe
> D:\>
> Wheres the range error??

The range error is 'entry' is a string, and you are slicing it beyond it's end.
This is not a bug in the compiler or runtime, it's in your code.

-- 
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