Invalid union member
问题 Is there a way in Visual Studio to handle non-trivial unions. The following code is running fine using g++ -std=c++11 but VS complains: invalid union member -- class "Foo" has a disallowed member function The code is as follows: struct Foo { int value; Foo(int inV = 0) : value(inV) {} }; union CustomUnion { CustomUnion(Foo inF) : foo(inF) {} CustomUnion(int inB) : bar(inB) {} int bar; Foo foo; }; int main() { CustomUnion u(3); return 0; } Is there a way in Visual Studio to support this kind