Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) C4217

Visual Studio .NET 2003

'operator' : member template functions cannot be used for copy-assignment or copy-construction

A copy operator was defined incorrectly.

This warning is off by default. See Compiler Warnings That Are Off by Default for more information.

The following sample generates C4217:

// C4217.cpp
// compile with: /W1
#pragma warning(default : 4217)
struct A
   template <class T>
   // copy-assignment will use compiler-generated one
   T& operator=(const T& in);
   // uncomment the following code to resolve
   template <>
   // copy-assignment will use this one
   A& operator=(const A& in);
};   // C4217

int main()
© 2015 Microsoft