diff --git a/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp b/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp @@ -690,7 +690,7 @@ Stream << "->"; } - Stream << MethodDecl->getName(); + Stream << MethodDecl->getNameAsString(); } else { Stream << " { return "; switch (LP.Callable.CE) { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize-avoid-bind.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize-avoid-bind.cpp --- a/clang-tools-extra/test/clang-tidy/checkers/modernize-avoid-bind.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize-avoid-bind.cpp @@ -43,6 +43,7 @@ struct D { D() = default; void operator()(int x, int y) const {} + operator bool() const { return true; } void MemberFunction(int x) {} @@ -360,6 +361,14 @@ auto DDD = std::bind(&D::MemberFunction, _1, 1); // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer a lambda to std::bind // CHECK-FIXES: auto DDD = [](auto && PH1) { PH1->MemberFunction(1); }; + + auto EEE = std::bind(&D::operator(), d, 1, 2); + // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer a lambda to std::bind + // CHECK-FIXES: auto EEE = [d] { d->operator()(1, 2); } + + auto FFF = std::bind(&D::operator bool, d); + // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer a lambda to std::bind + // CHECK-FIXES: auto FFF = [d] { d->operator bool(); } } };