Can we use nested template classes?

Can we not use nested template classes in CUDA 5.0? For me, the following fails:

template <typename U> class cls {
	template <typename V> class nest {
		void bar(V x);

template <typename U>
template <typename V>
void cls<U>::nest<V>::bar(V x) {}

int main(int argc, const char* argv[]) {
	return 0;


I cannot compile your sample with my host compiler:
$ g++ my.cpp
my.cpp:11: error: ‘cls::nest’ is not a type
my.cpp:11: error: too many template-parameter-lists

$ clang -std=c++11 my.cpp
my.cpp:11:14: error: expected a class or namespace
void cls::nest::bar(V x) {}
1 error generated.

Missed a after “nest” when copying and pasting into forum - have updated above example.

Now the above is the correct example of broken code.

Any ideas now?