www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24384] New: roundRobin crashes with empty first argument

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

          Issue ID: 24384
           Summary: roundRobin crashes with empty first argument
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of Phobos 2.107.0, the following program crashes with an AssertError at
runtime:

---
void main()
{
    import std.range: roundRobin;

    auto r = roundRobin("", "a");
    if (!r.empty)
        auto e = r.front;
}
---

The error message is:

---
core.exception.AssertError /usr/include/dmd/phobos/std/range/package.d(2351):
Attempting to fetch the front of an empty roundRobin
----------------
??:? _d_assert_msg [0x558a54569f5c]
/usr/include/dmd/phobos/std/range/package.d:2353 pure  property  safe dchar
std.range.roundRobin!(immutable(char)[],
immutable(char)[]).roundRobin(immutable(char)[],
immutable(char)[]).Result.front() [0x558a545601a1]
./bug.d:7 _Dmain [0x558a5455f75d]
---

--
Feb 09