clang-tidy - bugprone-parent-virtual-call — Extra Clang Tools 21.1.8 documentation

# Extra Clang Tools 21.1.8 documentation

## clang-tidy - bugprone-parent-virtual-call

# bugprone-parent-virtual-call

Detects and fixes calls to grand-…parent virtual methods instead of calls to overridden parent’s virtual methods.

    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]
    };