Edit

Share via


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.

Example

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
};