public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r10-10029] libstdc++: Implement LWG 3465 for std::compare_partial_order_fallback [PR101056] Date: Wed, 11 Aug 2021 16:35:29 +0000 (GMT) [thread overview] Message-ID: <20210811163529.924F93985453@sourceware.org> (raw) https://gcc.gnu.org/g:452bfa3f41733eed6f07e5a8aae0bb8214cc6ce6 commit r10-10029-g452bfa3f41733eed6f07e5a8aae0bb8214cc6ce6 Author: Jonathan Wakely <jwakely@redhat.com> Date: Mon Jun 14 12:30:52 2021 +0100 libstdc++: Implement LWG 3465 for std::compare_partial_order_fallback [PR101056] libstdc++-v3/ChangeLog: PR libstdc++/101056 * libsupc++/compare (compare_partial_order_fallback): Add constraint using reversed parameter order, as per LWG 3465. * testsuite/18_support/comparisons/algorithms/fallback.cc: Adjust expected result. (cherry picked from commit b76a529c095f076c4780df0c913cf6d2391bcbc9) Diff: --- libstdc++-v3/libsupc++/compare | 14 ++++++++++++-- .../18_support/comparisons/algorithms/fallback.cc | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare index 97c8f29f53a..3a1d85a4c96 100644 --- a/libstdc++-v3/libsupc++/compare +++ b/libstdc++-v3/libsupc++/compare @@ -806,6 +806,16 @@ namespace std } }; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3465. compare_partial_order_fallback requires F < E + template<typename _Tp, typename _Up> + concept __op_eq_lt_lt = __op_eq_lt<_Tp, _Up> + && requires(_Tp&& __t, _Up&& __u) + { + { static_cast<_Up&&>(__u) < static_cast<_Tp&&>(__t) } + -> convertible_to<bool>; + }; + class _Partial_fallback { template<typename _Tp, typename _Up> @@ -821,7 +831,7 @@ namespace std public: template<typename _Tp, __decayed_same_as<_Tp> _Up> - requires __partially_ordered<_Tp, _Up> || __op_eq_lt<_Tp, _Up> + requires __partially_ordered<_Tp, _Up> || __op_eq_lt_lt<_Tp, _Up> constexpr partial_ordering operator()(_Tp&& __e, _Up&& __f) const noexcept(_S_noexcept<_Tp, _Up>()) @@ -829,7 +839,7 @@ namespace std if constexpr (__partially_ordered<_Tp, _Up>) return _Partial_order{}(static_cast<_Tp&&>(__e), static_cast<_Up&&>(__f)); - else // __op_eq_lt<_Tp, _Up> + else // __op_eq_lt_lt<_Tp, _Up> return static_cast<_Tp&&>(__e) == static_cast<_Up&&>(__f) ? partial_ordering::equivalent : static_cast<_Tp&&>(__e) < static_cast<_Up&&>(__f) diff --git a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/fallback.cc b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/fallback.cc index ae458528f17..05e1bf7775e 100644 --- a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/fallback.cc +++ b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/fallback.cc @@ -38,5 +38,5 @@ static_assert( has_weak_order_fallback<S, S> ); static_assert( has_weak_order_fallback<const S, S> ); static_assert( ! has_weak_order_fallback<const S, const S> ); static_assert( has_partial_order_fallback<S, S> ); -static_assert( has_partial_order_fallback<const S, S> ); +static_assert( ! has_partial_order_fallback<const S, S> ); // LWG 3465 static_assert( ! has_partial_order_fallback<const S, const S> );
reply other threads:[~2021-08-11 16:35 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210811163529.924F93985453@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).