On Wed, 13 May 2026 at 13:44, Tomasz Kaminski <[email protected]> wrote:
>
>
>
> On Wed, May 13, 2026 at 2:32 PM Jonathan Wakely <[email protected]> wrote:
>>
>> On Wed, 13 May 2026 at 12:57, Tomasz Kamiński <[email protected]> wrote:
>> >
>> > Als uses type_identity_t in operator<=> signature to make it consistient
>> > with operator==.
>> >
>> > libstdc++-v3/ChangeLog:
>> >
>> > * include/std/string_view: Add _GLIBCXX_RESOLVE_LIB_DEFECTS
>> > comment for LWG3950.
>> > (operator<=>): Use type_identity_t instead of __type_identity_t.
>> > ---
>> > The consistency change technically changes signature, but that is fine,
>>
>> See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114400
>
> I think we should still define __type_identity as alias to type_identity when
> the later is available, so we will not have two instantiations for each type
> (one for code that is C++17 compatible and use __type_identity, and
> other commint from user programs).
Yes, I think that makes sense.
(We could still get two instantiations if some object files are
compiled as C++17 and some as C++20, but not if all object files use
the same dialect.)
The current patch is OK (changing __type_identity can be done separately).
>
>>
>>
>>
>> > not sure if it is worth it. Should we make __type_identity an alias to
>> > type_identity for modes when later is defined.
>> >
>> > Tested on x86_64-linux. OK for trunk?
>> >
>> > libstdc++-v3/include/std/string_view | 5 ++++-
>> > 1 file changed, 4 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/libstdc++-v3/include/std/string_view
>> > b/libstdc++-v3/include/std/string_view
>> > index 735d46f2de7..efbf432f112 100644
>> > --- a/libstdc++-v3/include/std/string_view
>> > +++ b/libstdc++-v3/include/std/string_view
>> > @@ -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)); }
>> > --
>> > 2.54.0
>> >
>>