[PATCH] libstdc++: Use _Clang::__no_specializations__ attribute in a few spots [PR120635]
Jonathan Wakely
jwakely@redhat.com
Wed Jul 15 15:42:13 GMT 2026
On Wed, 15 Jul 2026 at 16:28, Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Wed, Jul 15, 2026 at 03:47:55PM +0100, Jonathan Wakely wrote:
> > I wonder if we should do:
> >
> > #if __has_cpp_attribute(_Clang::__no_specializations__)
> > # define _GLIBCXX_NO_SPECIALIZATIONS(T) \
> > [[_Clang::__no_specializations__ ("explicit or partial specialization of std::" \
> > #T)]] T
> > #else
> > # define _GLIBCXX_NO_SPECIALIZATIONS(T) T
> > #endif
> >
> > And then we would not have to repeat the type:
> >
> > class _GLIBCXX_NO_SPECIALIZATIONS(tuple) {
> >
> > But that's minor and could be changed later.
>
> I also thought that it would be nice to move it out from the actual
> class definition to forward declaration, so have
> // _GLIBCXX_RESOLVE_LIB_DEFECTS
> // 3990. Program-defined specializations of std::tuple and std::variant
> // can't be properly supported
> template<typename... _Types>
> class _GLIBCXX_NO_SPECIALIZATIONS (std::variant) variant;
> ...
> template<typename... _Types>
> class variant
> : private __detail::__variant::_Variant_base<_Types...>,
> private _Enable_copy_move<
> __detail::__variant::_Traits<_Types...>::_S_copy_ctor,
> ...
Yes, that would be nice.
> but unfortunately that works only with g++ trunk, not with clang++,
> which then completely ignores the attribute.
Bah. I'll report a bug.
More information about the Libstdc++
mailing list