September 05, 2014 [Issue 13425] New: DList.linearRemove on last element returns non-empty range | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: murphyslaw480@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 -- |
Copyright © 1999-2021 by the D Language Foundation