I am using the GCC compiler's __float128, but I've encountered a problem. I have a class template in which __float128 is passed as a parameter, when I compile I get this error:
error: 'isnan' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]|
note: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, bool>::__type std::isnan(_Tp)' declared here, later in the translation unit|
error: call of overloaded 'isnan(const __float128&)' is ambiguous|
note: candidate: 'constexpr bool std::isnan(float)'|
note: candidate: 'constexpr bool std::isnan(double)'|
note: candidate: 'constexpr bool std::isnan(long double)'|
isnan() does not seem to recognize __float128. There is no overloaded function for __float128. However, I found a way to get rid of the error messages by writing this global function:
It helps to make my code compile again, but... is it ok? Have I done something that should have been solved differently? I am not sure if isnan() now handles __float128 correctly.