Skip to content

readability-static-accessed-through-instance fails to diagnose calls to member functions with out-of-class inline definitions #51861

@llvmbot

Description

@llvmbot
Bugzilla Link 52519
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions