template functions inside structs nvcc drops __device__ declaration?

Hi all,

Here is a simple piece of code with templates that works fine :

#include "stdio.h"

template<int n>

struct mystruct{

 __device__ __host__

  void foo(int * res)

  {

    *res = n;

  }

};

__global__  void g_test(int * res)

{

  mystruct<1> ms;

  ms.foo(res);

}

extern "C"

void  test()

{  

  int h_res;

  int * d_res = 0;

 cudaMalloc((void**)&d_res, sizeof(int));

  

  g_test<<<1, 1>>> (d_res);

  

  cudaMemcpy(&h_res, d_res, sizeof(int), cudaMemcpyDeviceToHost);

  cudaFree(d_res);

 printf("%d\n", h_res);

 return;

}

But if I modify the template a little to move the template from the struct to the function inside, the compilation is not possible anymore in Device mode (it still works in emulation mode) :

struct mystruct{

 template<int n>

  __device__ __host__

  void foo(int * res)

  {

    *res = n;

  }

};

__global__  void g_test(int * res)

{

  mystruct ms;

  ms.foo<1>(res);

}

The device declaration seems to have been droped somewhere, here is the error :

I know templates are not officially supported in cuda v1.0, but will this be possible in a future release?

Thanks