]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Use type_identity_t for operator<=> parameter [PR114400]
authorTomasz Kamiński <tkaminsk@redhat.com>
Wed, 13 May 2026 09:51:25 +0000 (11:51 +0200)
committerTomasz Kamiński <tkaminsk@redhat.com>
Wed, 13 May 2026 14:06:24 +0000 (16:06 +0200)
This matches change to operator== from r14-9642-gf4605c53ea2eeaf,
and implements exact resolution of LWG3950, "std::basic_string_view comparison
operators are overspecified". The difference between __type_identity and
type_identity is observable as illustrated by PR.

libstdc++-v3/ChangeLog:

PR libstdc++/114400
* include/std/string_view (operator<=>): Use type_identity_t
instead of __type_identity_t.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
libstdc++-v3/include/std/string_view

index 735d46f2de7f050625fffd2d2c973ceaf298f1dc..efbf432f112946a1bb712a2cd659e453e16b23e3 100644 (file)
@@ -621,6 +621,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // type (see N3766).
 
 #if __cpp_lib_three_way_comparison
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // 3950. std::basic_string_view comparison operators are overspecified 
+
   template<typename _CharT, typename _Traits>
     [[nodiscard]]
     constexpr bool
@@ -633,7 +636,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     [[nodiscard]]
     constexpr auto
     operator<=>(basic_string_view<_CharT, _Traits> __x,
-               __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+               type_identity_t<basic_string_view<_CharT, _Traits>> __y)
     noexcept
     -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
     { return __detail::__char_traits_cmp_cat<_Traits>(__x.compare(__y)); }