Consider this little code snippet
namespace nsp
{
template<typename T>
concept Addable= requires(const T& a,const T& b)
{
{a + b} -> std::convertible_to<T>;
};
template<Addable T>
struct C
{
C();
};
}
template<nsp::Addable T>
nsp::C<T>::C() {};
As shown here GCC (10.2) and clang (11.0) accept the code while MSVC (x86 19.28) rejects it with the error message:
error C3855: 'nsp::C<T>': template parameter 'T' is incompatible with the declaration.
Is this a MSVC bug or are GCC and clang wrong accepting it? Or alternatively, did I something stupid? If I move the out-of-line definition into the namespace nsp it seems to work for MSVC, as well. See this example.