From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id DB4C73858D28; Sat, 23 Mar 2024 11:09:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB4C73858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711192149; bh=6ZdpwqSaXN25wDY7+MmY4sl3yu9b/Iu4+lxERY6a+YU=; h=From:To:Subject:Date:From; b=GYZvEiV3Vh9ULzn9uWLLf6PUfadIfllL9HENMcOOYT4wY30Bed8KBfqNf35oRzPA3 AnNOr/CAZTIJ0fMuw18rGw69XgyJLbaqMn2UU7jSrQhMdZ0TlMd1vfV8Wi0R6XfEaE zZ2AA/oilJOvuftfNWdNHQLaECf26sEjKrn0EsBc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-9642] libstdc++: Use std::type_identity_t in as per LWG 3950 [PR114400] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 4a46a48ebc7b7b3976af49f6f8dabd65c6ddf64b X-Git-Newrev: f4605c53ea2eeafc13e14dd1ad00a0caf80057e2 Message-Id: <20240323110909.DB4C73858D28@sourceware.org> Date: Sat, 23 Mar 2024 11:09:09 +0000 (GMT) List-Id: https://gcc.gnu.org/g:f4605c53ea2eeafc13e14dd1ad00a0caf80057e2 commit r14-9642-gf4605c53ea2eeafc13e14dd1ad00a0caf80057e2 Author: Jonathan Wakely Date: Wed Mar 20 11:07:56 2024 +0000 libstdc++: Use std::type_identity_t in as per LWG 3950 [PR114400] 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. Diff: --- 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