Thread overview
[Issue 18780] Inconsistent behavior with Variant holding int converting to unsigned types
Mar 11, 2021
Dlang Bot
Apr 12, 2021
Dlang Bot
Apr 13, 2021
Dlang Bot
April 19, 2018
https://issues.dlang.org/show_bug.cgi?id=18780

monkeyworks12@hotmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monkeyworks12@hotmail.com

--- Comment #1 from monkeyworks12@hotmail.com ---
Looks like the problem is with std.traits.ImplicitConversionTargets:

pragma(msg, ImplicitConversionTargets!int); //(long, ulong, float, double,
real)

But it appears to be intentional. From ImplicitConversionTargets:


Note:
    The possible targets are computed more conservatively than the
    language allows, eliminating all dangerous conversions. For example,
    `ImplicitConversionTargets!double` does not include `float`.

template ImplicitConversionTargets(T)
{
    static if (is(T == bool))
        ....
    else static if (is(T == int))
        alias ImplicitConversionTargets =
            AliasSeq!(long, ulong, CentTypeList, float, double, real);
    else static if...
}

I don't know if it's better to change Variant or create a new, more permissible version of ImplicitConversionTargets.

--
March 11, 2021
https://issues.dlang.org/show_bug.cgi?id=18780

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@berni44 created dlang/phobos pull request #7842 "Fix Issue 18780 - Inconsistent behavior with Variant holding int converting to unsigned types" fixing this issue:

- Fix Issue 18780 - Inconsistent behavior with Variant holding int
  converting to unsigned types

https://github.com/dlang/phobos/pull/7842

--
April 12, 2021
https://issues.dlang.org/show_bug.cgi?id=18780

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@berni44 created dlang/phobos pull request #7954 "Fix Issue 18780 - Inconsistent behavior with Variant holding int converting to unsigned types" fixing this issue:

- Fix Issue 18780 - Inconsistent behavior with Variant holding int converting to unsigned types

https://github.com/dlang/phobos/pull/7954

--
April 13, 2021
https://issues.dlang.org/show_bug.cgi?id=18780

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/phobos pull request #7954 "Fix Issue 18780 - Inconsistent behavior with Variant holding int converting to unsigned types" was merged into master:

- 7afc9bff9d0547155a0e4a2755babcbe56599631 by berni44:
  Fix Issue 18780 - Inconsistent behavior with Variant holding int converting
to unsigned types

https://github.com/dlang/phobos/pull/7954

--