problem using C++ templates with CUDA 4

nvcc (CUDA 4 RC2) fails to compile the following

piece of C++ code, whereas it does with the CUDA 3.2

framework:

template <typename E>

struct base

{

};

template <typename E, unsigned I>

struct A : public base<A<E, I> >

{

};

template <typename T>

struct A<T, 0> : public base<A<T, 0> >

{

  typedef A<T, 0> self;

};

int main()

{

}

I am using the CUDA 4 RC2 32 bits framework on windows 7.

Edit: Problem solved, This workaround seems to bypass this bug:

template <typename E>

struct base

{

};

template <typename E, unsigned I>

struct A : public base<A<E, I> >

{

};

template <typename T>

struct id

{

  typedef T ret;

};

template <typename T>

struct A<T, 0> :

  public base<A<typename id<T>::ret, 0> >

{

  typedef A<T, 0> self;

};

int main()

{

}

When looking at the generated file test.cu.cpp, the following

line is syntactically incorrect:

#line 13 "test.cu"

struct A< T, 0>  : public base< A> {

External Image

Is there any workaround? Other than comming back to CUDA 3.2?

Thanks.