[Issue 10909] std.conv.to!(bool)(int): conversion from integer to bool

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 27 00:13:47 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10909



--- Comment #3 from monarchdodra at gmail.com 2013-08-27 00:13:46 PDT ---
The fix is pretty trivial, bools where not supported for the simple fact that
they are not on the "support" list.

The fix is:

1. std.conv:

Line 1309 Change:
T toImpl(T, S)(S value)
    if (!isImplicitlyConvertible!(S, T) &&
        (isNumeric!S || isSomeChar!S) &&
        (isNumeric!T || isSomeChar!T) && !is(T == enum))

To:
T toImpl(T, S)(S value)
    if (!isImplicitlyConvertible!(S, T) &&
        (isNumeric!S || isSomeChar!S || isBoolean!S) &&
        (isNumeric!T || isSomeChar!T || isBoolean!T) && !is(T == enum))

2. Traits:
Line 5691 Change:
template mostNegative(T)
    if(isNumeric!T || isSomeChar!T)

To:
template mostNegative(T)
    if(isNumeric!T || isSomeChar!T || isBoolean!T)

I don't have time to fix this myself right now, but if someone else does it,
and writes the corresponding unittests, I'd be glad to review it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list