Added a check which flags cases of a class inheriting from a struct, which can cause unintended scope issues since struct members are public by default.
Patch by Dennis Melamed
Differential D52552
[clang-tidy] Flag Classes Inheriting From Structs DennisMelamed on Sep 26 2018, 7:47 AM. Authored by
Details
Added a check which flags cases of a class inheriting from a struct, which can cause unintended scope issues since struct members are public by default. Patch by Dennis Melamed
Diff Detail Event TimelineComment Actions Please upload patches with full context. Would it make sense to not catch-all all the class : struct, but consider the explicitly specified inheritance visibility?
Comment Actions This strikes me as likely being a very chatty diagnostic. For instance, it will trigger on harmless code that uses empty base class optimization (in addition to other concerns pointed out by @lebedev.ri). It seems like the real concern here is unintentional information disclosure, but I don't see a good heuristic for determining that something is "unintentional" or not. I'd be curious to know how frequently this triggers on some large C++ code bases.
|
Please linewrap to 80 chars.