nvcc --version
Cuda compilation tools, release 9.1, V9.1.85
namespace NS {
template <class C>
class Helper
{
friend C;
};
struct S {};
} //NS
int main()
{
NS::Helper<NS::S> h;
return 0;
}
When compiling with: nvcc --std=c++11 I get the following error:
test.cu:5:11: error: ‘C’ in namespace ‘::’ does not name a type
Without the namespace the code compiles.
Based on the output of nvcc -v --keep it appears the friend class is tagged in the global scope, which it does not belong to:
# 1 "test.cu"
namespace NS {
# 2
template< class C>
# 3
class Helper {
# 5
friend <b>::C</b>;
# 6
};
# 8
struct S { };
# 9
}
This seems like an erroneous translation by nvcc.