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

           Summary: popFront() cycles when the range is empty
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: lovelyd...@mailmetrash.com


--- Comment #0 from SomeDude <lovelyd...@mailmetrash.com> 2012-04-19 05:38:23 
PDT ---
Original discussion:
http://forum.dlang.org/post/itrsidszogvnobzvl...@forum.dlang.org

import std.range, std.stdio;

void main()
{
   auto r = iota(3);

   writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
   r.popFront();
   writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
   r.popFront();
   writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
   r.popFront();
   writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
   r.popFront();
   writeln(r.front, ", length: ", r.length, " empty ? ", r.empty);
   r.popFront();
}

Returns:
0, length: 3 empty ? false
1, length: 2 empty ? false
2, length: 1 empty ? false
3, length: 0 empty ? true
4, length: 4294967295 empty ? false

Shouldn't popFront() assert when r.empty == true ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to