nvcc doesn't parse "mutable int x,y;"

Hello,

I’m using the last release of nvcc (provided in the CUDA3.0 SDK) with visual studio 2008.

When I’m trying to compile this piece of code:

class test

{

	mutable int x, y;

};

I got this error:

error C2059: syntax error : 'mutable '

However the following get compiled with no error :confused: :

class test

{

	mutable int y;

	mutable int x;

};

The problem is that this syntax is used in a header I cannot fix (it’s from Qt: qglobal.h).

Am I missing something? Is it a bug in the compiler?

Is there any workaround?

Thanks.

Matthieu

The usual workaround for nvcc bugs like this is to put all your conflicting code in a different .cpp file and only leave stuff than needs nvcc (kernels, device functions, host functions that launch kernels with <<< >>>) in the .cu.

I’m currently doing this, but it makes you writting some crapy things (manual template instantiation) when the kernels are templatized…

Hope the next nvcc will handle a larger set of c++ in host code :rolleyes: …

what I learned from a year of experience with CUDA: never use more complex language constructs then absolutely necessary. The closer to hardware the better. (also: never use uint64_t if two uint32_t’s will do). It will hopefully change when technology stabilizes.