https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114400

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Alternatively:

--- 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<typename _CharT, typename _Traits>
     [[nodiscard]]
     constexpr bool
     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
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }

-#if __cpp_lib_three_way_comparison
   template<typename _CharT, typename _Traits>
     [[nodiscard]]
     constexpr auto
@@ -620,7 +620,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
     { return __detail::__char_traits_cmp_cat<_Traits>(__x.compare(__y)); }
 #else
-  template<typename _CharT, typename _Traits>
+  template<typena  template<typename _CharT, typename _Traits>
+    [[nodiscard]]
+    constexpr bool
+    operator==(basic_string_view<_CharT, _Traits> __x,
+              __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+    noexcept
+    { return __x.size() == __y.size() && __x.compare(__y) == 0; }
+
+me _CharT, typename _Traits>
     [[nodiscard]]
     constexpr bool
     operator==(basic_string_view<_CharT, _Traits> __x,


Our other uses of __type_identity_t (e.g. in container constructors) are
probably OK. Users can't overload those, and the exact signatures of member
functions are unspecified anyway (we can add/remove default arguments).

Reply via email to