I have this code
typedef struct
{
const char* fooString;
const bool fooBool;
}fooStruct;
And this initializer:
static const fooStruct foo[] =
{
{"file1", true},
{"file2", false},
....
};
With this code I have 3 warnings in VS2008:
error C2220: warning treated as error - no 'object' file generated
warning C4510: '<unnamed-tag>' : default constructor could not be generated
warning C4512: '<unnamed-tag>' : assignment operator could not be generated
warning C4610: struct '<unnamed-tag>' can never be instantiated - user defined constructor required
The C4610 warning is incorrect. This is a known bug in Visual C++. See the Microsoft Connect bug “Improper issuance of C4610.”
Adam Rosenfield explains why the other two warnings (C4510 and C4512) are emitted.