Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 938 Bytes

compiler-warning-level-3-c4522.md

File metadata and controls

39 lines (31 loc) · 938 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 3) C4522
Compiler Warning (level 3) C4522
11/04/2016
C4522
C4522
7065dc27-0b6c-4e68-a345-c51cdb99a20b

Compiler Warning (level 3) C4522

'class' : multiple assignment operators specified

The class has multiple assignment operators of a single type. This warning is informational; the constructors are callable in your program.

Use the warning pragma to suppress this warning.

Example

The following sample generates C4522.

// C4522.cpp
// compile with: /EHsc /W3
#include <iostream>

using namespace std;
class A {
public:
   A& operator=( A & o ) { cout << "A&" << endl; return *this; }
   A& operator=( const A &co ) { cout << "const A&" << endl; return *this; }   // C4522
};

int main() {
   A o1, o2;
   o2 = o1;
   const A o3;
   o1 = o3;
}