-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isfinite
declared constexpr
for c++20
#3745
Comments
Locally fixed by defining
and using this define in the declaration of
I can propose a patch if you are happy with this solution. |
Please do. |
Dependent function std::isfinite is constexpr for c++23. https://en.cppreference.com/w/cpp/numeric/math/isfinite Fix fmtlib#3745
Dependent function std::isfinite is constexpr for c++23. https://en.cppreference.com/w/cpp/numeric/math/isfinite Fix fmtlib#3745
Which version of
In a constexpr context, the condition and code must be executed: if (is_constant_evaluated())
return !detail::isnan(value) && value < inf && value > -inf; |
When using Clang-17 and libc++-17 in c++20 mode, compilation and tests pass without errors: https://github.com/phprus/fmt/actions/runs/7149828208/job/19472458664 |
Will confirm the details on monday, but from my knowledge: the code is compiled with |
Turns out the standard library does not provide |
The implementation failed to be constexpr in the situation where: __cplusplus == 202002L && !defined(__cpp_lib_is_constant_evaluated) Fix fmtlib#3745
@hchataing, could you check if #3754 fixes the issue? |
I checked the compiler pre-defined variables, and it is not going to be sufficient.
|
|
You could check with something like #ifndef _LIBCPP_VERSION
# error _LIBCPP_VERSION undefined
#endif |
Should be fixed by #3754 but if you still get this issue feel free to reopen and provide more details, most importantly print the actual value of |
Got it, thanks for the help ! |
std::isfinite
is not declaredconstexpr
beforec++23
, butfmt::isfinite
is declaredconstexpr
forc++20
(https://en.cppreference.com/w/cpp/numeric/math/isfinite).
https://github.com/fmtlib/fmt/blob/master/include/fmt/core.h#L108:
https://github.com/fmtlib/fmt/blob/master/include/fmt/format.h#L2753:
Resulting compilation error:
Compiler version (Android 🤷 )
The text was updated successfully, but these errors were encountered: