'identifier' : non-aggregates cannot be initialized with initializer list
The aggregate identifier was incorrectly initialized.
Aggregates are defined as follows:
In addition, Visual C++ does not allow data types in an aggregate that themselves contain constructors.
The following code generates error C255:
#include <string> #include <iostream> using namespace std; struct Pair { string name; // could use char * name double val; }; int main() { string s("Test"); // could use // char* s = new char[5]; // strcpy(s, "Test"); Pair p = { s, 0 }; return 0; }