Open Quuxplusone opened 3 years ago
The readability-static-accessed-through-instance clang-tidy check fails to diagnose calls to member functions with out-of-class inline definitions.
A rather minimal example is on https://godbolt.org/z/8aT6xqqbx:
class Foo final { public: static Foo& getInstance(); static int getBar(); };
inline int Foo::getBar() { return 42; }
int main() { auto& params = Foo::getInstance();
params.getBar();
}
There's no clang-tidy diagnostic reported here. Note that when moving the definition of getBar into the class, a diagnostic will be reported.
getBar
The readability-static-accessed-through-instance clang-tidy check fails to diagnose calls to member functions with out-of-class inline definitions.
A rather minimal example is on https://godbolt.org/z/8aT6xqqbx:
class Foo final { public: static Foo& getInstance(); static int getBar(); };
inline int Foo::getBar() { return 42; }
int main() { auto& params = Foo::getInstance();
}
There's no clang-tidy diagnostic reported here. Note that when moving the definition of
getBar
into the class, a diagnostic will be reported.