MSVC doesn't accept this code, even the latest version on Godbolt:
#include <type_traits>
template <class R>
struct A {
A();
};
template <class R>
requires std::is_reference_v<R>
struct A<R> {
A();
};
template <class R>
A<R>::A() {}
template <class R>
requires std::is_reference_v<R>
A<R>::A() {}
I've never fully understood the rules for determining correspondence of templated declarations, so perhaps this is IFNDR for some reason, or perhaps this is just an MSVC bug. I'm leaning toward the latter, but either outcome is surprising. Is there any way to define member functions out of line when the same signature belongs to both a primary class template and to a specialization of it that differs only by being constrained, and have MSVC accept it? This seems like a pretty significant missing feature if not.
(I understand that pre-C++20 techniques can be used for defining the partial specialization but I'd like to avoid adding a dummy template parameter to the primary template.)