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

--- Comment #17 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This won't be implemented in time for GCC 12, sadly.

FWIW a class-scope explicit specialization should in most cases be equivalent
to an appropriately constrained partial specialization.  So as a workaround,
instead of e.g.:

struct A {
  template<class T>
  struct B;

  template<>
  struct B<int> { }; // unsupported class-scope explicit specialization
};

in C++20 one can do:

struct A {
  template<class T>
  struct B;

  template<std::same_as<int> T>
  struct B<T> { };
};

or in C++17:

struct A {
  template<class T, class = void>
  struct B;

  template<class T>
  struct B<T, std::enable_if_t<std::is_same_v<int, T>>> { };
};

Reply via email to