[Issue 19027] New: iota(int.min, int.max).length is incorrect

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 26 04:06:25 UTC 2018


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

          Issue ID: 19027
           Summary: iota(int.min, int.max).length is incorrect
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: davidbennett at bravevision.com

---
void main()
{
  import std.range : iota;
  import std.conv : to;

  auto length = iota(int.min, int.max).length;
  assert(length == uint.max, "opps... length is " ~ length.to!string);
}
---

fails with:

core.exception.AssertError@[snip]: opps... length is 18446744073709551615
----------------
??:? _d_assert_msg [0x18578d52]
??:? _Dmain [0x1855e6cc]

I iota seems work fine with byte, short and long, it's just int that has
issues.

Thanks,
David

--


More information about the Digitalmars-d-bugs mailing list