Skip to content

Commit

Permalink
Fix isfinite implementation to be constexpr
Browse files Browse the repository at this point in the history
The implementation failed to be constexpr in the situation where:
  __cplusplus == 202002L && !defined(__cpp_lib_is_constant_evaluated)

Fix fmtlib#3745
  • Loading branch information
hchataing committed Dec 12, 2023
1 parent dee0dbf commit f68bff6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit f68bff6

Please sign in to comment.