I am trying to statically initialize the following structure in Visual Studio 2010:
struct Data
{
int x;
union
{
const Data* data;
struct {int x; int y; };
};
};
The following is fails with error C2440: 'initializing' : cannot convert from 'Data *' to 'char'
.
static Data d1;
static Data d = {1, &d1};
static Data d2 = {1, {1, 2}};
I have found references to some ways this can be initialized properly but none of them work in VS2010. Any ideas?