Running into an issue with some code that compiles on GCC and Clang, but not MSVC (VS2022). Seems similar to this, but that was several years ago and this issue is specifically caused by the use of derived_from_specialization_of in the method template, so I'm not sure if it's the same issue.
I'm wondering what the reason for this is, and if the issue is with my code or MSVC.
Example:
#include <concepts>
template <template <class...> class Template, class... Args>
void derived_from_specialization_impl(const Template<Args...>&);
template <class T, template <class...> class Template>
concept derived_from_specialization_of = requires(const T& t) {
derived_from_specialization_impl<Template>(t);
};
template <class T>
class A
{
public:
A() = default;
};
template <derived_from_specialization_of<A> T>
class B;
template <derived_from_specialization_of<B> T>
class C
{
public:
C() = default;
};
template <derived_from_specialization_of<A> T>
class B
{
public:
B() = default;
template <derived_from_specialization_of<B> U>
C<U> Foo();
template <derived_from_specialization_of<B> U>
C<U> Bar()
{
return C<U>();
}
};
template <derived_from_specialization_of<A> T>
template <derived_from_specialization_of<B> U>
C<U> B<T>::Foo()
{
return C<U>();
}