Reproducer:
template<class T1, class T2>
struct A {
template <class T3>
void foo(T3 x);
};
template<typename T1, typename T2>
template<typename T3>
void A<T1, T2>::foo<T3>(T3 x) {
}
The syntax of definition of “foo” is incorrect according to Member templates - cppreference.com
But it can be compiled by nvcc without any error: Compiler Explorer
It clashes with the C++ standard, clang cannot build it: Compiler Explorer
I think it is a bug in nvcc.
See more related discussion in CUDA code compile error: function template partial specialization is not allowed · Issue #68772 · llvm/llvm-project · GitHub