Compiler Error C3194
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3194.
member' : a value-type cannot have an assignment operator
Special member functions that require automatic invocation by the compiler, such as a copy constructor or copy assignment operator are not supported within a value class.
The following sample generates C3194.
// C3194.cpp
// compile with: /clr /c
value struct MyStruct {
MyStruct& operator= (const MyStruct& i) { return *this; } // C3194
};
ref struct MyStruct2 {
MyStruct2% operator= (const MyStruct2% i) { return *this; } // OK
};
Show: