Bug Report - CUDA 2.3 apparent bug with templates

Sorry if this is posted in the wrong place. I couldn’t find a designated bug report area or thread.

Code that was running fine with cudatoolkit_2.2_macos_32.pkg fails to run with cudatoolkit_2.3_macos_32.pkg. Reverted to the 2.2 install to make sure, and sure enough, it works again. Code is below:

#include <stdio.h>

struct Gof 

{

	__device__ void operator()(int){return;};

	

};

template<typename Fex>

__global__ void Bob(Fex f)

{

	int bigo = 0;

	f(bigo);

	return;

	

}

int main (int argc, char * const argv[]) 

{

	// insert code here...

   printf("Hello\n");

   struct Gof joe;

   Bob<<<1,1>>>(joe);

	return 0;

}

The error that is produced is something along the lines of “error: Gof is not a template type”. Running on a 2ndish gen macbook pro with an ati gpu. Terminal command used is simply “nvcc fnu.cu -o test”. I tried various options like -deviceemu, and the -arch flags, but it didn’t seem to help any.

just to clarify, this same code compiles and runs fine on CUDA 2.3 for linux.

Paul

soooooo, can anyone confirm this error, or am I the only one getting it?

I’ve also seen this error with Mac + CUDA 2.3 + templates. Seems to be new behavior with 2.3.

I concur. I didn’t have this problem with earlier versions of CUDA, but now my code doesn’t compile. Has anyone filed a bug report yet?

Sorry, should have mentioned I filed a bug with my first reply in this thread.

Here’s a workaround, by the way:

#include <stdio.h>

// XXX breaks

//struct Gof

//{

//	__device__ void operator()(int){return;};

//	

//};

template<unsigned int dummy = 0>

struct Gof

{

  __device__ void operator()(int){return;}

};

template<typename Fex>

__global__ void Bob(Fex f)

{

	int bigo = 0;

	f(bigo);

	return;

	

}

int main (int argc, char * const argv[])

{

	// insert code here...

   printf("Hello\n");

   //struct Gof joe;

   struct Gof<> joe;

   Bob<<<1,1>>>(joe);

	return 0;

}

This issue will be resolved in the next nvcc release.

Cool, looks like it’s working again with 2.3a. Thanks. :)