编译器警告(等级 4)C4625

“derived class”: 未能生成复制构造函数,因为基类复制构造函数不可访问

不可访问基类中的复制构造函数,因此无法为派生类生成复制构造函数。 复制此类型对象的任何尝试都将导致编译器错误。

默认情况下关闭此警告。 有关更多信息,请参见默认情况下处于关闭状态的编译器警告

示例

下面的示例生成 C4625。

// C4625.cpp
// compile with: /W4 /c
#pragma warning(default : 4625)

struct A {
   A() {}

private:
   A(const A&) {}
};

struct C : private virtual A {};
struct B :  C {};   // C4625 no copy constructor

struct D : A {};
struct E :  D {};   // OK