www.digitalmars.com         C & C++   DMDScript  

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


          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 puremagic.com
          Reporter: davidbennett 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


Jun 25 2018