This works...
struct FOO
{
char bar1[50 + 1];
char bar2[50 + 1];
};
FOO foo[] =
{
{"baz1", "baz2"},
{"baz3", "baz4"}
};
But this does not...
struct FOO2
{
FOO2(void) { };
char bar1[50 + 1];
char bar2[50 + 1];
};
FOO2 foo2[] =
{
{"baz1", "baz2"},
{"baz3", "baz4"}
};
Morover, this...
struct FOO3
{
void init(void) { };
char bar1[50 + 1];
char bar2[50 + 1];
};
FOO3 foo3[] =
{
{"baz1", "baz2"},
{"baz3", "baz4"}
};
...works too.
So, methods don't disallow array initialization but a constructor does.
From Microsoft's error description these attributes (among others) cause an entity to become a "non-aggregate" and therefore no longer a valid target for array initialization:
Constructors
Private or protected members
Base classes
Virtual functions
Why, in the case of constructors?