class Base
{
enum Type
{
First,
Second,
};
};
class Derived : public Base
{
};
void function()
{
auto type = Derived::Type::First;
}
Accessing a member of a base class through a derived type is confusing and leads to wrong assumptions about which header file you need to include.
This rule is similar to the clang tidy rule about accessing static class members through an instance of said class https://clang.llvm.org/extra/clang-tidy/checks/readability/static-accessed-through-instance.html