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
Please upload patches with full context.
Please do follow coding style, clang-format your patches.
Would it make sense to not catch-all all the class : struct, but consider the explicitly specified inheritance visibility?
Please linewrap to 80 chars.
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.
I don't agree with the predicate here -- structs aren't just used for C compatibility (look at <type_traits> as an example). They're also useful when all members need to be public, which is exactly the situation you claim may be unintentional.
Also, i have only thought about it, there are no tests about what happens if you (say, publicly) inherit from struct, that does not have anything public.