From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 5F3053890026 for ; Mon, 14 Jun 2021 13:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F3053890026 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-340-X8X9pNQrOty58dxcFZcikA-1; Mon, 14 Jun 2021 09:08:12 -0400 X-MC-Unique: X8X9pNQrOty58dxcFZcikA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A8815800D55; Mon, 14 Jun 2021 13:08:11 +0000 (UTC) Received: from localhost (unknown [10.33.36.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id 535AC18AD4; Mon, 14 Jun 2021 13:08:11 +0000 (UTC) Date: Mon, 14 Jun 2021 14:08:10 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 2/2] libstdc++: Implement LWG 3465 for std::compare_partial_order_fallback [PR101056] Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="j6K+773p4CjcOooo" Content-Disposition: inline X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2021 13:08:21 -0000 --j6K+773p4CjcOooo Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline 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. Tested powerpc64le-linux. Committed to trunk. --j6K+773p4CjcOooo Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit b76a529c095f076c4780df0c913cf6d2391bcbc9 Author: Jonathan Wakely Date: Mon Jun 14 12:30:52 2021 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. diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare index b1f342113f1..dd0ec5fa36d 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 + 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; + }; + class _Partial_fallback { template @@ -821,7 +831,7 @@ namespace std public: template _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 ); static_assert( has_weak_order_fallback ); static_assert( ! has_weak_order_fallback ); static_assert( has_partial_order_fallback ); -static_assert( has_partial_order_fallback ); +static_assert( ! has_partial_order_fallback ); // LWG 3465 static_assert( ! has_partial_order_fallback ); --j6K+773p4CjcOooo--