njames93 added a comment.

In D147924#4255209 <https://reviews.llvm.org/D147924#4255209>, @PiotrZSL wrote:

> Problem is that you may have specialization of Bar class wihtout bar base, 
> and that specialization can be local to some compilation unit.
> Like:
>
>   template<>
>   struct Bar<int> {
>       void bar(); // function wihout virtual or no function at all.
>   };
>
> And now your fix (override) won't compile.
>
> Only configuration option possible to be done, is to check template 
> instantiations or not, but this going to produce false-positives.
> And probably we don't want false-positives in this check.

My idea was to not check any template instantiations, instead look for template 
definitions with a template dependent base class that has potential override 
candidates.

I'd argue a (likely very rare) false positive that would prevent compilation is 
better than not diagnosing and then potentially(due to a later refactor) 
getting a near miss override candidate going undiagnosed and breaking the 
codebase.
It could also be nicer to just emit a warning with no fix, or a fix added to a 
note explaining the situation. (notes fixes aren't automatically applied when 
running clang tidy(and clang) for this reason.

Given the contention that is why i suggested this should just be user 
configurable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147924/new/

https://reviews.llvm.org/D147924

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to