Skip to content

Commit

Permalink
Merge pull request #2315 from 9rnsr/fix13076
Browse files Browse the repository at this point in the history
[REG2.066a] Issue 13076 - [dmd 2.066-b2] DList clearing of empty list
  • Loading branch information
WalterBright authored and 9rnsr committed Jul 11, 2014
1 parent 72cdb9f commit 9102be6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion std/container/dlist.d
Expand Up @@ -477,6 +477,9 @@ Complexity: $(BIGOH 1)
*/
Range remove(Range r)
{
if (r.empty)
return r;

assert(_root !is null, "Cannot remove from an un-initialized List");
assert(r._first, "Remove: Range is empty");

Expand Down Expand Up @@ -800,4 +803,11 @@ unittest //12566
assert(dl2[].walkLength == 1);
dl2.removeBack();
assert(dl2.empty, "not empty?!");
}
}

unittest //13076
{
DList!int list;
assert(list.empty);
list.clear();
}

0 comments on commit 9102be6

Please sign in to comment.