Fix isfinite implementation to be constexpr

The implementation failed to be constexpr in the situation where:
  __cplusplus == 202002L && !defined(__cpp_lib_is_constant_evaluated)

Fix #3745
This commit is contained in:
Henri Chataing 2023-12-12 09:46:24 -08:00
parent dee0dbf07f
commit f68bff6084

View File

@ -2752,7 +2752,7 @@ template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value&&
has_isfinite<T>::value)>
FMT_CONSTEXPR20 bool isfinite(T value) {
constexpr T inf = T(std::numeric_limits<double>::infinity());
if (is_constant_evaluated())
if (is_constant_evaluated(true))
return !detail::isnan(value) && value < inf && value > -inf;
return std::isfinite(value);
}