[libcxx-commits] [libcxx] [libc++][math] Fix acceptance of convertible types in `std::isnan()` and `std::isinf()` (PR #98952)
Robin Caloudis via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 31 07:59:59 PDT 2024
robincaloudis wrote:
> Do I understand correctly that the `convertible-to` tests fail only in the combination of libc++/C++03/glibc?
>
> It seems to me like the cure may be worse than the disease in this case, I'm not certain this is worth addressing given the complexity it introduces. In a certain way, this can be seen as a bug in glibc since there's no such issue in other standard modes and in other standard libraries.
>
> Instead, we could add the missing test coverage and disable it with a comment based on `TEST_STD_VER <= 03`
Totally agree. The complexity is very high. The following is my current understanding: Disabling the missing tests based on `TEST_STD_VER <= 03` will still forces us to handle the non-standardized function declaration of `isnan(double)` with return type of `int` that glibc's `math.h` brings into scope. In order to handle that we need to either follow glib's approach of [`#undef isnan` from math.h in their <cmath>](https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/math.h;l=322-323;drc=master?hl=fr-BE%22https:%2F%2Fsupport.google.com%2Fmerchants%2Fanswer%2F188494%5C%22%22https:%2F%2Fsupport.google.com%2Fmerchants%2Fanswer%2F188494%5C%22) or displace the overload of the glibc library with `_LIBCPP_PREFERRED_OVERLOAD`. Note that `_LIBCPP_PREFERRED_OVERLOAD` was in place before. What I did was to restrict it to only the necessary situations. I believed that the underlying issue was not well understood up to this point and that's why `_LIBCPP_PREFERRED_OVERLOAD` is used as a "one-size-fits-it-all" solution. Please correct me if I misunderstand :)
https://github.com/llvm/llvm-project/pull/98952
More information about the libcxx-commits
mailing list