[Issue 13425] New: DList.linearRemove on last element returns non-empty range
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Sep 5 10:56:54 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13425
Issue ID: 13425
Summary: DList.linearRemove on last element returns non-empty
range
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: murphyslaw480 at gmail.com
Created attachment 1417
--> https://issues.dlang.org/attachment.cgi?id=1417&action=edit
The example above, in case you care to test it
If a range refers to the last element in a DList, I would expect linearRemove
to return an empty range. Instead it returns a non-empty range that appears to
access memory outside the list's bounds.
Example:
auto list = DList!int([1,2,3,4,5]);
auto r = list[].drop(4); // r is a view of the last element of list
assert(r.front == 5 && r.walkLength == 1);
r = list.linearRemove(r.take(1));
assert(r.empty); // fails
--
More information about the Digitalmars-d-bugs
mailing list