Look at this code.
#include <type_traits>
template<typename T>
struct C;
template<typename T>
requires std::is_integral_v<T>
struct C<T>
{
void f();
};
template<typename T>
requires std::is_integral_v<T>
void C<T>::f()
{
}
template<typename T>
requires std::is_pointer_v<T>
struct C<T>
{
void f();
};
template<typename T>
requires std::is_pointer_v<T>
void C<T>::f()
{
}
I want to add functions to the specializations as you see, i.e. functions that don't exist in the non-specialized variant. But the compiler says
class template "C<T>" has no member "f"'.
The above code compiles without any problems with GCC 11.1.0, but not with Clang 13 or current MSVC.
I want to forward-declared class C without any implementation. And I don't want to have a defined class C with a f inside it. The added f in the specializations would have no meaning in the base-class I'm concerned about.