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,
...
but unfortunately that works only with g++ trunk, not with clang++,
which then completely ignores the attribute.
Jakub