https://issues.dlang.org/show_bug.cgi?id=15041
Issue ID: 15041
Summary: Pointer slice with one negative index throws 'Range
violation'
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
When slicing a pointer, if one (not both) of the indices is negative, it throws
a Range violation. Tested with DMD 2.068.1
example:
auto p = &"aaaaaaaaaaaaaaaaaaaaa"[5];
assert(p[-1] == 'a'); // no problem
assert(p[-3 .. -1] == "aa"); // no problem
assert(p[-1 .. 1] == "aa"); // 'Range violation'
( http://dpaste.dzfl.pl/3be7eb85483c )
--