编译器错误 C2264

“function”:函数定义或声明中有错误;未调用函数

由于定义或声明不正确,无法调用该函数。

下面的示例生成 C2264:

// C2264.cpp
struct C {
   // Delete the following line to resolve.
   operator int(int = 0){}   // incorrect declaration
};

struct D {
   operator int(){return 0;}   // OK
};

int main() {
   int i;

   C c;
   i = c;   // C2264

   D d;
   i = d;   // OK
}