[libcxx-commits] [libcxx] [libc++] P2602R2 Poison Pills are Too Toxic (PR #74534)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 5 15:03:02 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 11ba327e69531255eae550d4de1eb07cd8c1ad39 aaccb9e13618517803df1230741b02b4c5ee08c7 -- libcxx/test/std/language.support/cmp/cmp.alg/ordinary_unqualified_lookup_helpers.h libcxx/test/std/ranges/range.access/ordinary_unqualified_lookup_helpers.h libcxx/include/__compare/partial_order.h libcxx/include/__compare/strong_order.h libcxx/include/__compare/weak_order.h libcxx/include/__iterator/iter_move.h libcxx/include/__ranges/access.h libcxx/include/__ranges/rbegin.h libcxx/include/__ranges/rend.h libcxx/include/__ranges/size.h libcxx/include/version libcxx/test/std/iterators/iterator.requirements/iterator.cust/iterator.cust.move/iter_move.pass.cpp libcxx/test/std/iterators/iterator.requirements/iterator.cust/iterator.cust.swap/iter_swap.pass.cpp libcxx/test/std/language.support/cmp/cmp.alg/partial_order.pass.cpp libcxx/test/std/language.support/cmp/cmp.alg/strong_order.pass.cpp libcxx/test/std/language.support/cmp/cmp.alg/weak_order.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp libcxx/test/std/ranges/range.access/begin.pass.cpp libcxx/test/std/ranges/range.access/end.pass.cpp libcxx/test/std/ranges/range.access/rbegin.pass.cpp libcxx/test/std/ranges/range.access/rend.pass.cpp libcxx/test/std/ranges/range.access/size.pass.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__compare/partial_order.h b/libcxx/include/__compare/partial_order.h
index b422bdd4ef..091cb1dd9b 100644
--- a/libcxx/include/__compare/partial_order.h
+++ b/libcxx/include/__compare/partial_order.h
@@ -28,40 +28,41 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __partial_order {
- void partial_order() = delete;
+void partial_order() = delete;
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<2>)
- noexcept(noexcept(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
- // NOLINTEND(libcpp-robust-against-adl)
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept(
+ noexcept(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
+ noexcept(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()); }
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>());
+ }
};
} // namespace __partial_order
diff --git a/libcxx/include/__compare/strong_order.h b/libcxx/include/__compare/strong_order.h
index ba59cb51b8..13b1f67f1f 100644
--- a/libcxx/include/__compare/strong_order.h
+++ b/libcxx/include/__compare/strong_order.h
@@ -34,97 +34,96 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __strong_order {
- void strong_order() = delete;
-
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<2>)
- noexcept(noexcept(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
- // NOLINTEND(libcpp-robust-against-adl)
-
- template<class _Tp, class _Up, class _Dp = decay_t<_Tp>>
- requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
- _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept
- {
- if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int32_t)) {
- int32_t __rx = std::bit_cast<int32_t>(__t);
- int32_t __ry = std::bit_cast<int32_t>(__u);
- __rx = (__rx < 0) ? (numeric_limits<int32_t>::min() - __rx - 1) : __rx;
- __ry = (__ry < 0) ? (numeric_limits<int32_t>::min() - __ry - 1) : __ry;
- return (__rx <=> __ry);
- } else if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int64_t)) {
- int64_t __rx = std::bit_cast<int64_t>(__t);
- int64_t __ry = std::bit_cast<int64_t>(__u);
- __rx = (__rx < 0) ? (numeric_limits<int64_t>::min() - __rx - 1) : __rx;
- __ry = (__ry < 0) ? (numeric_limits<int64_t>::min() - __ry - 1) : __ry;
- return (__rx <=> __ry);
- } else if (__t < __u) {
- return strong_ordering::less;
- } else if (__t > __u) {
- return strong_ordering::greater;
- } else if (__t == __u) {
- if constexpr (numeric_limits<_Dp>::radix == 2) {
- return std::signbit(__u) <=> std::signbit(__t);
- } else {
- // This is bullet 3 of the IEEE754 algorithm, relevant
- // only for decimal floating-point;
- // see https://stackoverflow.com/questions/69068075/
- if (__t == 0 || std::isinf(__t)) {
- return std::signbit(__u) <=> std::signbit(__t);
- } else {
- int __texp, __uexp;
- (void)std::frexp(__t, &__texp);
- (void)std::frexp(__u, &__uexp);
- return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp);
- }
- }
- } else {
- // They're unordered, so one of them must be a NAN.
- // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN.
- bool __t_is_nan = std::isnan(__t);
- bool __u_is_nan = std::isnan(__u);
- bool __t_is_negative = std::signbit(__t);
- bool __u_is_negative = std::signbit(__u);
- using _IntType = conditional_t<
- sizeof(__t) == sizeof(int32_t), int32_t, conditional_t<
- sizeof(__t) == sizeof(int64_t), int64_t, void>
- >;
- if constexpr (is_same_v<_IntType, void>) {
- static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type");
- } else if (__t_is_nan && __u_is_nan) {
- // Order by sign bit, then by "payload bits" (we'll just use bit_cast).
- if (__t_is_negative != __u_is_negative) {
- return (__u_is_negative <=> __t_is_negative);
- } else {
- return std::bit_cast<_IntType>(__t) <=> std::bit_cast<_IntType>(__u);
- }
- } else if (__t_is_nan) {
- return __t_is_negative ? strong_ordering::less : strong_ordering::greater;
- } else {
- return __u_is_negative ? strong_ordering::greater : strong_ordering::less;
- }
- }
+void strong_order() = delete;
+
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept(
+ noexcept(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
+
+ template <class _Tp, class _Up, class _Dp = decay_t<_Tp>>
+ requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept {
+ if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int32_t)) {
+ int32_t __rx = std::bit_cast<int32_t>(__t);
+ int32_t __ry = std::bit_cast<int32_t>(__u);
+ __rx = (__rx < 0) ? (numeric_limits<int32_t>::min() - __rx - 1) : __rx;
+ __ry = (__ry < 0) ? (numeric_limits<int32_t>::min() - __ry - 1) : __ry;
+ return (__rx <=> __ry);
+ } else if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int64_t)) {
+ int64_t __rx = std::bit_cast<int64_t>(__t);
+ int64_t __ry = std::bit_cast<int64_t>(__u);
+ __rx = (__rx < 0) ? (numeric_limits<int64_t>::min() - __rx - 1) : __rx;
+ __ry = (__ry < 0) ? (numeric_limits<int64_t>::min() - __ry - 1) : __ry;
+ return (__rx <=> __ry);
+ } else if (__t < __u) {
+ return strong_ordering::less;
+ } else if (__t > __u) {
+ return strong_ordering::greater;
+ } else if (__t == __u) {
+ if constexpr (numeric_limits<_Dp>::radix == 2) {
+ return std::signbit(__u) <=> std::signbit(__t);
+ } else {
+ // This is bullet 3 of the IEEE754 algorithm, relevant
+ // only for decimal floating-point;
+ // see https://stackoverflow.com/questions/69068075/
+ if (__t == 0 || std::isinf(__t)) {
+ return std::signbit(__u) <=> std::signbit(__t);
+ } else {
+ int __texp, __uexp;
+ (void)std::frexp(__t, &__texp);
+ (void)std::frexp(__u, &__uexp);
+ return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp);
}
-
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
-
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()); }
+ }
+ } else {
+ // They're unordered, so one of them must be a NAN.
+ // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN.
+ bool __t_is_nan = std::isnan(__t);
+ bool __u_is_nan = std::isnan(__u);
+ bool __t_is_negative = std::signbit(__t);
+ bool __u_is_negative = std::signbit(__u);
+ using _IntType =
+ conditional_t< sizeof(__t) == sizeof(int32_t),
+ int32_t,
+ conditional_t< sizeof(__t) == sizeof(int64_t), int64_t, void> >;
+ if constexpr (is_same_v<_IntType, void>) {
+ static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type");
+ } else if (__t_is_nan && __u_is_nan) {
+ // Order by sign bit, then by "payload bits" (we'll just use bit_cast).
+ if (__t_is_negative != __u_is_negative) {
+ return (__u_is_negative <=> __t_is_negative);
+ } else {
+ return std::bit_cast<_IntType>(__t) <=> std::bit_cast<_IntType>(__u);
+ }
+ } else if (__t_is_nan) {
+ return __t_is_negative ? strong_ordering::less : strong_ordering::greater;
+ } else {
+ return __u_is_negative ? strong_ordering::greater : strong_ordering::less;
+ }
+ }
+ }
+
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
+ noexcept(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>());
+ }
};
} // namespace __strong_order
diff --git a/libcxx/include/__compare/weak_order.h b/libcxx/include/__compare/weak_order.h
index 8d7f939092..82b4c1f891 100644
--- a/libcxx/include/__compare/weak_order.h
+++ b/libcxx/include/__compare/weak_order.h
@@ -28,68 +28,67 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __weak_order {
- void weak_order() = delete;
+void weak_order() = delete;
- struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<3>)
- noexcept(noexcept(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
- // NOLINTEND(libcpp-robust-against-adl)
+struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<3>) noexcept(
+ noexcept(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
+ // NOLINTEND(libcpp-robust-against-adl)
- template<class _Tp, class _Up, class _Dp = decay_t<_Tp>>
- requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
- _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering
- __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept
- {
- partial_ordering __po = (__t <=> __u);
- if (__po == partial_ordering::less) {
- return weak_ordering::less;
- } else if (__po == partial_ordering::equivalent) {
- return weak_ordering::equivalent;
- } else if (__po == partial_ordering::greater) {
- return weak_ordering::greater;
- } else {
- // Otherwise, at least one of them is a NaN.
- bool __t_is_nan = std::isnan(__t);
- bool __u_is_nan = std::isnan(__u);
- bool __t_is_negative = std::signbit(__t);
- bool __u_is_negative = std::signbit(__u);
- if (__t_is_nan && __u_is_nan) {
- return (__u_is_negative <=> __t_is_negative);
- } else if (__t_is_nan) {
- return __t_is_negative ? weak_ordering::less : weak_ordering::greater;
- } else {
- return __u_is_negative ? weak_ordering::greater : weak_ordering::less;
- }
- }
- }
+ template <class _Tp, class _Up, class _Dp = decay_t<_Tp>>
+ requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept {
+ partial_ordering __po = (__t <=> __u);
+ if (__po == partial_ordering::less) {
+ return weak_ordering::less;
+ } else if (__po == partial_ordering::equivalent) {
+ return weak_ordering::equivalent;
+ } else if (__po == partial_ordering::greater) {
+ return weak_ordering::greater;
+ } else {
+ // Otherwise, at least one of them is a NaN.
+ bool __t_is_nan = std::isnan(__t);
+ bool __u_is_nan = std::isnan(__u);
+ bool __t_is_negative = std::signbit(__t);
+ bool __u_is_negative = std::signbit(__u);
+ if (__t_is_nan && __u_is_nan) {
+ return (__u_is_negative <=> __t_is_negative);
+ } else if (__t_is_nan) {
+ return __t_is_negative ? weak_ordering::less : weak_ordering::greater;
+ } else {
+ return __u_is_negative ? weak_ordering::greater : weak_ordering::less;
+ }
+ }
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<1>)
- noexcept(noexcept(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
+ noexcept(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_Tp&& __t, _Up&& __u, __priority_tag<0>)
- noexcept(noexcept(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype( weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- { return weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); }
+ template <class _Tp, class _Up>
+ requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
+ noexcept(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
+ -> decltype(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
+ return weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
+ }
- template<class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())))
- -> decltype( __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>()))
- { return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>()); }
+ template <class _Tp, class _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())))
+ -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())) {
+ return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>());
+ }
};
} // namespace __weak_order
diff --git a/libcxx/test/std/ranges/range.access/begin.pass.cpp b/libcxx/test/std/ranges/range.access/begin.pass.cpp
index 89e1e130c2..ddf7b37c69 100644
--- a/libcxx/test/std/ranges/range.access/begin.pass.cpp
+++ b/libcxx/test/std/ranges/range.access/begin.pass.cpp
@@ -196,7 +196,7 @@ struct BeginFunction {
};
static_assert( std::is_invocable_v<RangeBeginT, BeginFunction const&>);
static_assert(!std::is_invocable_v<RangeBeginT, BeginFunction &&>);
-static_assert( std::is_invocable_v<RangeBeginT, BeginFunction &>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
+static_assert(std::is_invocable_v<RangeBeginT, BeginFunction&>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
static_assert( std::is_invocable_v<RangeCBeginT, BeginFunction const&>);
static_assert( std::is_invocable_v<RangeCBeginT, BeginFunction &>);
diff --git a/libcxx/test/std/ranges/range.access/end.pass.cpp b/libcxx/test/std/ranges/range.access/end.pass.cpp
index 749c20fe4c..b137ff0525 100644
--- a/libcxx/test/std/ranges/range.access/end.pass.cpp
+++ b/libcxx/test/std/ranges/range.access/end.pass.cpp
@@ -197,7 +197,7 @@ static_assert(!std::is_invocable_v<RangeEndT, EndFunction &&>);
static_assert( std::is_invocable_v<RangeEndT, EndFunction const&>);
static_assert(!std::is_invocable_v<RangeEndT, EndFunction &&>);
-static_assert( std::is_invocable_v<RangeEndT, EndFunction &>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
+static_assert(std::is_invocable_v<RangeEndT, EndFunction&>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
static_assert( std::is_invocable_v<RangeCEndT, EndFunction const&>);
static_assert( std::is_invocable_v<RangeCEndT, EndFunction &>);
diff --git a/libcxx/test/std/ranges/range.access/rbegin.pass.cpp b/libcxx/test/std/ranges/range.access/rbegin.pass.cpp
index 9bd804b59d..dee0445f20 100644
--- a/libcxx/test/std/ranges/range.access/rbegin.pass.cpp
+++ b/libcxx/test/std/ranges/range.access/rbegin.pass.cpp
@@ -191,7 +191,8 @@ struct RBeginFunction {
};
static_assert( std::is_invocable_v<RangeRBeginT, RBeginFunction const&>);
static_assert(!std::is_invocable_v<RangeRBeginT, RBeginFunction &&>);
-static_assert( std::is_invocable_v<RangeRBeginT, RBeginFunction &>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
+static_assert(
+ std::is_invocable_v<RangeRBeginT, RBeginFunction&>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
static_assert( std::is_invocable_v<RangeCRBeginT, RBeginFunction const&>);
static_assert( std::is_invocable_v<RangeCRBeginT, RBeginFunction &>);
diff --git a/libcxx/test/std/ranges/range.access/rend.pass.cpp b/libcxx/test/std/ranges/range.access/rend.pass.cpp
index eb45889ca7..8db5cf1377 100644
--- a/libcxx/test/std/ranges/range.access/rend.pass.cpp
+++ b/libcxx/test/std/ranges/range.access/rend.pass.cpp
@@ -200,7 +200,7 @@ static_assert(!std::is_invocable_v<RangeREndT, REndFunction &&>);
static_assert( std::is_invocable_v<RangeREndT, REndFunction const&>);
static_assert(!std::is_invocable_v<RangeREndT, REndFunction &&>);
-static_assert( std::is_invocable_v<RangeREndT, REndFunction &>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
+static_assert(std::is_invocable_v<RangeREndT, REndFunction&>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
static_assert( std::is_invocable_v<RangeCREndT, REndFunction const&>);
static_assert( std::is_invocable_v<RangeCREndT, REndFunction &>);
diff --git a/libcxx/test/std/ranges/range.access/size.pass.cpp b/libcxx/test/std/ranges/range.access/size.pass.cpp
index 36bd19ba8c..f35b2d659c 100644
--- a/libcxx/test/std/ranges/range.access/size.pass.cpp
+++ b/libcxx/test/std/ranges/range.access/size.pass.cpp
@@ -223,7 +223,8 @@ inline constexpr bool std::ranges::disable_sized_range<const ImproperlyDisabledF
static_assert( std::is_invocable_v<RangeSizeT, ImproperlyDisabledMember&>);
static_assert( std::is_invocable_v<RangeSizeT, const ImproperlyDisabledMember&>);
-static_assert( std::is_invocable_v<RangeSizeT, ImproperlyDisabledFunction&>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
+static_assert(std::is_invocable_v<RangeSizeT,
+ ImproperlyDisabledFunction&>); // Ill-formed before P2602R2 Poison Pills are Too Toxic
static_assert( std::is_invocable_v<RangeSizeT, const ImproperlyDisabledFunction&>);
// No begin end.
``````````
</details>
https://github.com/llvm/llvm-project/pull/74534
More information about the libcxx-commits
mailing list