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.129.124]) by sourceware.org (Postfix) with ESMTPS id B533F3858C33 for ; Sat, 23 Mar 2024 11:09:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B533F3858C33 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 B533F3858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711192179; cv=none; b=cs9OaXVPDakitR5ugE9XURh+Dh2tElO6Yl24qq/mv6BbgVRnpXugOErhIbDB4kN0c/LMlFn43A9UATjseiNVzjeZI3/Kzu3GgN4+6AqYic1ELGnTicYsZAcNcQY/znvfIGRgjAFF4tdZFCyoCA1J1qAjxgXc+Gs931u47mJioL0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711192179; c=relaxed/simple; bh=DFIhFynw550O1TqWcbgyBVpe3mWlr4IKmc/BopjJAec=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=weLEPR8Vf4+KIyWKdoD+k7UXGIxUnXYzNTQBBvBFM4BmDEyedTAmStpfDrxvqZXqY6/2IqRIWkkg9Uu+YvDwuDw9uf6j+SuEo4rDcwoOgsxM3mHtLcHFIzQHgIWH2P0BbQN+xnzlH92cxAbQi1HxZzXgSXh/Zy6MqOwarxwBdKU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711192176; 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=gTEtzGKTrSzDYnJ5LN5w2e/Jt4jEEPZw1HCZyRW1uCQ=; b=iXDyZSRcATHx2th1m/mkRTmBwXgdh5VRUa31mvQsmqmaw55VA89K+mmL+TFJ9OWGMuh8YG eAKd/VRkFpRH5wOewoqqpqLnJBOtrQERoGK8S5XHtkXL558a/HEfOe1+1MY61bGWs5luph IKUIC4F5NcGTQSdVH6hSxVXHh3kPVoY= 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-391-5z0yTDHLMLmt5klvL3UTNQ-1; Sat, 23 Mar 2024 07:09:34 -0400 X-MC-Unique: 5z0yTDHLMLmt5klvL3UTNQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 6FC993C02792; Sat, 23 Mar 2024 11:09:34 +0000 (UTC) Received: from localhost (unknown [10.42.28.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C4AD1121337; Sat, 23 Mar 2024 11:09:34 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Use std::type_identity_t in as per LWG 3950 [PR114400] Date: Sat, 23 Mar 2024 11:09:10 +0000 Message-ID: <20240323110929.426054-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.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=ham 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 aarch64-linux. Pushed to trunk. -- >8 -- The difference between __type_identity_t and std::type_identity_t is observable, as demonstrated in the PR. Nobody in LWG seems to think this an example we should really care about, but it seems easy and harmless to change this. libstdc++-v3/ChangeLog: PR libstdc++/114400 * include/std/string_view (operator==): Use std::type_identity_t in C++20 instead of our own __type_identity_t. --- libstdc++-v3/include/std/string_view | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view index e30a9c1768e..a7c5a126461 100644 --- a/libstdc++-v3/include/std/string_view +++ b/libstdc++-v3/include/std/string_view @@ -602,15 +602,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // deduction and the other argument gets implicitly converted to the deduced // type (see N3766). +#if __cpp_lib_three_way_comparison template [[nodiscard]] constexpr bool operator==(basic_string_view<_CharT, _Traits> __x, - __type_identity_t> __y) + type_identity_t> __y) noexcept { return __x.size() == __y.size() && __x.compare(__y) == 0; } -#if __cpp_lib_three_way_comparison template [[nodiscard]] constexpr auto @@ -620,6 +620,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0)) { return __detail::__char_traits_cmp_cat<_Traits>(__x.compare(__y)); } #else + template + [[nodiscard]] + constexpr bool + operator==(basic_string_view<_CharT, _Traits> __x, + __type_identity_t> __y) + noexcept + { return __x.size() == __y.size() && __x.compare(__y) == 0; } + template [[nodiscard]] constexpr bool -- 2.44.0