[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 04:26:07 PDT 2013


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



--- Comment #4 from growlercab at gmail.com 2013-08-27 04:26:05 PDT ---
(In reply to comment #3)
> 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.

https://github.com/D-Programming-Language/phobos/pull/1525

OK, I had a go at this. It is my first D contribution so hopefully I did
everything correctly.

Cheers,
G

-- 
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