bugprone-parent-virtual-call¶
检测并修复对祖父母虚拟方法的调用,而不是对重写父类虚拟方法的调用。
struct A {
int virtual foo() {...}
};
struct B: public A {
int foo() override {...}
};
struct C: public B {
int foo() override { A::foo(); }
// ^^^^^^^^
// warning: qualified name A::foo refers to a member overridden in subclass; did you mean 'B'? [bugprone-parent-virtual-call]
};