[Issue 16246] cannot call iota with 3 [u]bytes or 3 [u]shorts

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 7 05:53:45 PDT 2016


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
I looked at the errors:
/Users/steves/.dvm/compilers/dmd-2.071.1/osx/bin/../../src/phobos/std/range/package.d(4751):
Error: cannot implicitly convert expression (cast(int)pastLast - 1) of type int
to ushort
/Users/steves/.dvm/compilers/dmd-2.071.1/osx/bin/../../src/phobos/std/range/package.d(4756):
Error: cannot implicitly convert expression (cast(int)pastLast + 1) of type int
to ushort
/Users/steves/.dvm/compilers/dmd-2.071.1/osx/bin/../../src/phobos/std/range/package.d(4773):
Error: cannot implicitly convert expression (cast(int)this.pastLast -
cast(int)this.step) of type int to inout(ushort)

We are just adding/subtracting 1 or step in each of these. Just cast to the
correct type, should be sufficient. Alternatively, you can use += or -=
instead.

May need to `static if` this fix for only builtin types, as custom types
probably already handle the operations correctly, and we don't want to mess
with that.

--


More information about the Digitalmars-d-bugs mailing list