[Issue 18349] std/math.d(543,33): Deprecation: integral promotion not done for -x
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 7 00:26:54 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18349
Timothee Cour <timothee.cour2 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |timothee.cour2 at gmail.com
--- Comment #1 from Timothee Cour <timothee.cour2 at gmail.com> ---
IIRC: was triggered from dfmt by an input of type `immutable(short)` looks like
logic breaks when input is immutable?
Num abs(Num)(Num x) @safe pure nothrow
if ((is(typeof(Num.init >= 0)) && is(typeof(-Num.init)) ||
(is(Num == short) || is(Num == byte))) &&
!(is(Num* : const(ifloat*)) || is(Num* : const(idouble*))
|| is(Num* : const(ireal*))))
{
static if (isFloatingPoint!(Num))
return fabs(x);
else
{
static if (is(Num == short) || is(Num == byte))
return x >= 0 ? x : cast(Num) -int(x);
else
return x >= 0 ? x : -x;
}
}
--
More information about the Digitalmars-d-bugs
mailing list