vbvictor wrote:

> There’s also a broader upstream fit question. clang-tidy intentionally hosts 
> checks for different code styles (and some are even mutually conflicting), 
> but the successful upstream checks usually map to something widely accepted 
> in major style guides or to a well-scoped bug pattern with low noise. This 
> rule doesn’t really seem enforced by any major C++ style guide in that form. 
> It feels more like an “XY problem”: we want to catch polymorphic deletion 
> with a non-virtual base destructor (the real bug), but we’re enforcing “avoid 
> certain inheritance shapes” as a proxy. That proxy is where the false 
> positives and design pressure come from.

There is one widely accepted guideline 
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c35-a-base-class-destructor-should-be-either-public-and-virtual-or-protected-and-non-virtual.
I think it is pretty close to what we try to make here. I'm positive if we 
implement such check:

> Enforcement
A class with any virtual functions should have a destructor that is either 
public and virtual or else protected and non-virtual.
If a class inherits publicly from a base class, the base class should have a 
destructor that is either public and virtual or else protected and non-virtual.


https://github.com/llvm/llvm-project/pull/183384
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to