Date: Tue, 2 Nov 2021 15:50:30 -0400
In C++11, [c.math¶11] says:
> if any argument corresponding to a double parameter has type double or an integer type, then all arguments corresponding to double parameters are effectively cast to double.
(The latest draft appears to contain equivalent wording.)
About `isnan` in particular, cppreference¹ says:
> bool isnan( IntegralType arg ); (since C++11)
...which appears to be a result of the above quoted paragraph.
Accordingly, is this snippet expected to compile?
long long x = ...;
std::isnan(x);
At least MSVC rejects it². Is my understanding wrong, or is MSVC
non-conforming?
(¹ https://en.cppreference.com/w/cpp/numeric/math/isnan)
(² https://godbolt.org/z/b3E5b5bzE)
> if any argument corresponding to a double parameter has type double or an integer type, then all arguments corresponding to double parameters are effectively cast to double.
(The latest draft appears to contain equivalent wording.)
About `isnan` in particular, cppreference¹ says:
> bool isnan( IntegralType arg ); (since C++11)
...which appears to be a result of the above quoted paragraph.
Accordingly, is this snippet expected to compile?
long long x = ...;
std::isnan(x);
At least MSVC rejects it². Is my understanding wrong, or is MSVC
non-conforming?
(¹ https://en.cppreference.com/w/cpp/numeric/math/isnan)
(² https://godbolt.org/z/b3E5b5bzE)
-- Matthew
Received on 2021-11-02 14:50:36