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 ESMTPS id 22DF53846403 for ; Fri, 19 Apr 2024 20:08:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 22DF53846403 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 22DF53846403 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713557320; cv=none; b=jrbzQk+YNpADzu44aeglwEQk8zwU+nzFfALV1TvIKaZzJ9zO6YQLtaNNC2MvdWxHuDA+OwgVKOouHgchbv5dLOdU7JzuCZ8qB2oobeCKaWJ9AdCJpXRQB8GeFlqJRpSB3wWNycNH3yjIkjLLOG2lmsjIwyA/3dPx2efMcxOU37s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713557320; c=relaxed/simple; bh=sEUOjyEhFVyFKuefDaQVHP55pqYQtWIoRRRjt4VMmBk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=iq/TPn2hx8Z48loBPk6kk1fUieF3QORIDA16KChyk++cX9KT9+c1WCgnFoim+VDPTheQkbLpqIg5xoKR8VmIV0J7CunMGYUajFqPoonS0SZgMeH7lxjNzt4Z586Yi3oqgXGndczLKYfn2Q8e/uCAzhJUvVVbiu/wOBWaMsV2gxU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713557318; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yIAlqz9MMw8N8ZCqKllR3Z8lipjmXBvtuPdiXONewiY=; b=VR6zo4rY7aBEC17rIMon4BBdsl01domVEoatvvyUYenQecfs2tUO2y4ak2wNduhAjEXD1I 3ZrV/yHqoXrf1alSzAaNyVubsZgjgFLlsK99nz8w/ir+iLsQzm2LB133GK8ILsng1vUSW+ NKT6X2fyrdLe0Z72KKirZW+Q4Y8wfbI= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-118-qvmWK9FAPweDdY30A1TDEg-1; Fri, 19 Apr 2024 16:08:35 -0400 X-MC-Unique: qvmWK9FAPweDdY30A1TDEg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2AD031C3F107; Fri, 19 Apr 2024 20:08:35 +0000 (UTC) Received: from localhost (unknown [10.42.28.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE6FB40005B; Fri, 19 Apr 2024 20:08:34 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Simplify constraints on <=> for std::reference_wrapper Date: Fri, 19 Apr 2024 21:08:21 +0100 Message-ID: <20240419200834.1500201-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.2 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_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-linux. Pushed to trunk. -- >8 -- Instead of constraining these overloads in terms of synth-three-way we can just check that the value_type is less-than-comparable, which is what synth-three-way's constraints check. The reason that I implemented these with constraints has now been filed as LWG 4071, so add a comment about that too. libstdc++-v3/ChangeLog: * include/bits/refwrap.h (operator<=>): Simplify constraints. --- libstdc++-v3/include/bits/refwrap.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/include/bits/refwrap.h b/libstdc++-v3/include/bits/refwrap.h index fd1cc2b63e6..71ec2b297b7 100644 --- a/libstdc++-v3/include/bits/refwrap.h +++ b/libstdc++-v3/include/bits/refwrap.h @@ -384,23 +384,29 @@ _GLIBCXX_MEM_FN_TRAITS(&& noexcept, false_type, true_type) && requires { { __x.get() == __y.get() } -> convertible_to; } { return __x.get() == __y.get(); } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 4071. reference_wrapper comparisons are not SFINAE-friendly + [[nodiscard]] friend constexpr auto - operator<=>(reference_wrapper __x, reference_wrapper<_Tp> __y) - requires requires { __detail::__synth3way(__x.get(), __y.get()); } + operator<=>(reference_wrapper __x, reference_wrapper __y) + requires requires (const _Tp __t) { + { __t < __t } -> __detail::__boolean_testable; + } { return __detail::__synth3way(__x.get(), __y.get()); } [[nodiscard]] friend constexpr auto operator<=>(reference_wrapper __x, const _Tp& __y) - requires requires { __detail::__synth3way(__x.get(), __y); } + requires requires { { __y < __y } -> __detail::__boolean_testable; } { return __detail::__synth3way(__x.get(), __y); } [[nodiscard]] friend constexpr auto operator<=>(reference_wrapper __x, reference_wrapper __y) - requires (!is_const_v<_Tp>) - && requires { __detail::__synth3way(__x.get(), __y.get()); } + requires (!is_const_v<_Tp>) && requires (const _Tp __t) { + { __t < __t } -> __detail::__boolean_testable; + } { return __detail::__synth3way(__x.get(), __y.get()); } #endif }; -- 2.44.0