The compiler found a problem with the syntax to create a pointer-to-member. Ex:
class A {
public:
int func(){return 0;}
} a;
int (*pf)() = &a.func; // C2276
class B {
public:
void mf() {
&this -> mf; // C2276
}
};
int main() {
A a;
&a.func; // C2276
}
Possible resolution:
class A {
public:
int func(){return 0;}
} a;
int (A::*pf3)() = &A::func;
class B {
public:
void mf() {
&B::mf;
}
};
int main() {
A a;
&A::func;
}
This article is a derivative work based on Compiler Error C2276 which is provided by MSDN Community Content - Visual C++.