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
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8042,8 +8042,8 @@ static void AddTemplateOverloadCandidateImmediately(

Candidate.IgnoreObjectArgument =
isa<CXXMethodDecl>(Candidate.Function) &&
cast<CXXMethodDecl>(Candidate.Function)
->isImplicitObjectMemberFunction() &&
!cast<CXXMethodDecl>(Candidate.Function)
->isExplicitObjectMemberFunction() &&
!isa<CXXConstructorDecl>(Candidate.Function);

Candidate.ExplicitCallArguments = Args.size();
Expand Down
32 changes: 32 additions & 0 deletions clang/test/SemaCXX/cxx2b-deducing-this.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1357,3 +1357,35 @@ void Bar(this int) { // expected-note {{candidate function}}
}

}

namespace GH147046_regression {

template <typename z> struct ai {
ai(z::ah);
};

template <typename z> struct ak {
template <typename am> void an(am, z);
template <typename am> static void an(am, ai<z>);
};
template <typename> struct ao {};

template <typename ap>
auto ar(ao<ap> at) -> decltype(ak<ap>::an(at, 0));
// expected-note@-1 {{candidate template ignored: substitution failure [with ap = GH147046_regression::ay]: no matching function for call to 'an'}}

class aw;
struct ax {
typedef int ah;
};
struct ay {
typedef aw ah;
};

ao<ay> az ;
ai<ax> bd(0);
void f() {
ar(az); // expected-error {{no matching function for call to 'ar'}}
}

}