zinovy.nis added inline comments.
================
Comment at: test/clang-tidy/bugprone-parent-virtual-call.cpp:105
+
+// Test virtual method is diagnosted although not overridden in parent.
+class BI : public A {
----------------
aaron.ballman wrote:
> Typo: diagnosted -> diagnosed
oops, thanks.
================
Comment at: test/clang-tidy/bugprone-parent-virtual-call.cpp:113
+ int virt_1() override { return A::virt_1(); }
+ // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: qualified function name
A::virt_1 refers to a function not from a direct base class; did you mean 'BI'?
[bugprone-parent-virtual-call]
+ // CHECK-FIXES: int virt_1() override { return BI::virt_1(); }
----------------
aaron.ballman wrote:
> This seems like a false positive to me. Yes, the virtual function is
> technically exposed in `BI`, but why is the programmer obligated to call that
> one rather than the one from `A`, which is written in the source?
IMHO it's a matter of safety. Today virt_1() is not overridden in BI, but
tomorrow someone will implement BI::virt_1() and it will silently lead to bugs
or whatever.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D44295
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits