Fix: Replace std::floating_point concept with std::is_floating_point_v for Apple Clang 14.0.0 compatibility #49182
+432
−50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes the CRAN build failure on macOS 13.3 with Apple Clang 14.0.0.
The problem is that
std::floating_point<T>is a C++20 concept, but Apple Clang 14.0.0 doesn't have full support for it yet. When building, it errors out saying it can't findfloating_pointin thestdnamespace.I swapped it out for
std::is_floating_point_v<T>instead, which is basically the same thing but uses a C++17 variable template that works fine with older compilers. I also added#include <type_traits>since that's whereis_floating_point_vlives.Behavior is unchanged - still matches all the floating point types (float, double, long double) plus util::Float16. Just using a different approach that the older compiler can handle.
Fixes #49176