this code works fine before I add the string to the struct, then I get "Exception thrown: read access violation. _Pnext was 0xCDCDCDD1" in xmemory. I have marked the line with the error with a comment.
#include <iostream>
#include <string>
struct Test {
Test() {}
std::string name;
};
int main()
{
Test* a;
a = (Test*)malloc(2 * sizeof(Test));
a[0] = Test(); // ERROR HERE
std::cout << "Hello World!\n";
}