“function”:数字重载对“this”指针没有合法转换
注解
编译器无法将 this 转换为成员函数的任何重载版本。
此错误可能是由调用 const 对象上的非 const 成员函数造成的。 可能的解决方法:
从对象声明中删除
const。将
const添加到成员函数重载之一。
Example
以下示例生成 C2663:
// C2663.cpp
struct C {
void f() volatile {}
void f() {}
};
struct D {
void f() volatile;
void f() const {}
};
const C *pcc;
const D *pcd;
int main() {
pcc->f(); // C2663
pcd->f(); // OK
}