www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13390] New: std.range.cycle ctor fails when empty input passed

https://issues.dlang.org/show_bug.cgi?id=13390

          Issue ID: 13390
           Summary: std.range.cycle ctor fails when empty input passed
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: drug2004 bk.ru

import std.range;

void main()
{
        auto d = [0, 1, 2];
        auto b = cycle(d[0..0]); // generates SIGFPE
}

because std.range.cycle ctor doesn't check length equality to zero
(https://github.com/D-Programming-Language/phobos/blob/master/std/range.d#L4471)
But I believe zero length should be possible.

--
Aug 28 2014