Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Warning (level 3) C4521
Collapse the table of content
Expand the table of content

Compiler Warning (level 3) C4521

Error Message

'class' : multiple copy constructors specified

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

Use the warning pragma to suppress this warning.


The following sample generates C4521.

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

using namespace std;
class A {
   A() { cout << "A's default constructor" << endl; }
   A( A &o ) { cout << "A&" << endl; }
   A( const A &co ) { cout << "const A&" << endl; }   // C4521

int main() {
   A o1;         // Calls default constructor.
   A o2( o1 );   // Calls A( A& ).
   const A o3;   // Calls default constructor.
   A o4( o3 );   // Calls A( const A& ).

Community Additions

© 2015 Microsoft