mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 23:50:31 +03:00
Reorder abs constraints to avoid the integral promotion deprecation message
This commit is contained in:
parent
eabbc8e949
commit
d9e4524e06
1 changed files with 3 additions and 3 deletions
|
@ -628,8 +628,8 @@ template isDeprecatedComplex(T)
|
|||
*/
|
||||
auto abs(Num)(Num x)
|
||||
if (!isDeprecatedComplex!Num &&
|
||||
(is(typeof(Num.init >= 0)) && is(typeof(-Num.init)) ||
|
||||
(is(Unqual!Num == short) || is(Unqual!Num == byte))))
|
||||
(is(Unqual!Num == short) || is(Unqual!Num == byte)) ||
|
||||
(is(typeof(Num.init >= 0)) && is(typeof(-Num.init))))
|
||||
{
|
||||
static if (isFloatingPoint!(Num))
|
||||
return fabs(x);
|
||||
|
@ -723,7 +723,7 @@ static foreach (Num; AliasSeq!(cfloat, cdouble, creal, ifloat, idouble, ireal))
|
|||
{
|
||||
return v;
|
||||
}
|
||||
Vector!(float, 3) v;
|
||||
Vector!(int, 3) v;
|
||||
assert(abs(v) == v);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue