编译器警告(等级 3)C4281
“operator ->”通过类型“type”发生递归
你的代码允许“operator->”调用自身。
下面的示例生成 C4281:
// C4281.cpp
// compile with: /W3 /WX
struct A;
struct B;
struct C;
struct A
{
int z;
B& operator->();
};
struct B
{
C& operator->();
};
struct C
{
A& operator->();
};
void f(A p)
{
int i = p->z; // C4281
}