[libcxx-commits] [libcxx] [libc++] Avoid -Wzero-as-null-pointer-constant in operator<=> (PR #79465)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 25 08:46:18 PST 2024
================
@@ -30,14 +30,17 @@ class partial_ordering;
class weak_ordering;
class strong_ordering;
-template <class _Tp, class... _Args>
-inline constexpr bool __one_of_v = (is_same_v<_Tp, _Args> || ...);
-
struct _CmpUnspecifiedParam {
- _LIBCPP_HIDE_FROM_ABI constexpr _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
-
- template <class _Tp, class = enable_if_t<!__one_of_v<_Tp, int, partial_ordering, weak_ordering, strong_ordering>>>
- _CmpUnspecifiedParam(_Tp) = delete;
+ template <class _Tp, class = __enable_if_t<is_same_v<_Tp, int>>>
+ _LIBCPP_HIDE_FROM_ABI consteval _CmpUnspecifiedParam(_Tp __zero) noexcept {
----------------
cor3ntin wrote:
Ill-formed make sense to me,
The scenario would be the presence of a `<=>` operator overload that returns something that is not a standard comparison category, but compares to `0` ? Seems unlikely
https://github.com/llvm/llvm-project/pull/79465
More information about the libcxx-commits
mailing list