This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
template<typename _Tp> typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type abs(_Tp)
overload to cmath, causing a call to std::abs with an argument of type short to return a double, even if cstdlib is also included (which declares the int, long, long long overloads). That commit does not give any rationale.
(I apparently wondered about that already a couple of years ago, but all I can find now in my notes is "[...] only to discover libstdc++'s over-eager interpretation of C++11 cmath requirements causes std::abs with a short argument to chose the double overload," which no longer rings much of a bell with me.)
This issue happens to crop up again now in the context of the LibreOffice code base, see <https://gerrit.libreoffice.org/#/c/22050/> "Make abs return int, not double," which reportedly is on Fedora Rawhide.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |