Hi there. I’m currently using the CUDA 4.0 compiler.
The current status is that it supports structs/classes with empty constructors, but no members with empty constructors:
struct X
{
X() {}
};
struct Y
{
Y() {}
X x;
};
__shared__ X x; // ok, compiler detects empty c'tor
__shared__ Y y; // error, even though c'tor is empty
As far as I know, there really is no work-around if you need to overload the c’tor of Y.
However, if Y is POD (plain old data), you can change the class to a union and put the members in an anonyomous struct:
union Y
{
struct { X x; }
};
__shared__ X x; // ok, compiler detects empty c'tor
__shared__ Y y; // ok, compiler detects empty c'tor