Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/lib/Sema/HeuristicResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ std::vector<const NamedDecl *> HeuristicResolverImpl::resolveDependentMember(
if (!Filter(ND))
return false;
if (const auto *MD = dyn_cast<CXXMethodDecl>(ND)) {
return MD->getMethodQualifiers().compatiblyIncludes(QT.getQualifiers(),
return !MD->isInstance() ||
MD->getMethodQualifiers().compatiblyIncludes(QT.getQualifiers(),
Ctx);
}
return true;
Expand Down
20 changes: 20 additions & 0 deletions clang/unittests/Sema/HeuristicResolverTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,26 @@ TEST(HeuristicResolver, MemberExpr_SmartPointer_Qualified) {
cxxMethodDecl(hasName("find"), isConst()).bind("output"));
}

TEST(HeuristicResolver, MemberExpr_Static_Qualified) {
std::string Code = R"cpp(
template <typename T>
struct Waldo {
static void find();
};
template <typename T>
void foo(const Waldo<T>& t) {
t.find();
}
)cpp";
// Test resolution of "find" in "t.find()".
// The object being `const` should have no bearing on a call to a static
// method.
expectResolution(
Code, &HeuristicResolver::resolveMemberExpr,
cxxDependentScopeMemberExpr(hasMemberName("find")).bind("input"),
cxxMethodDecl(hasName("find")).bind("output"));
}

TEST(HeuristicResolver, MemberExpr_AutoTypeDeduction1) {
std::string Code = R"cpp(
template <typename T>
Expand Down