[PATCH] D36390: Fix overloaded static functions in SemaCodeComplete

Ivan Donchevskii via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 02:20:17 PST 2017


yvvan added inline comments.


================
Comment at: cfe/trunk/lib/Sema/SemaOverload.cpp:6365
                            cast<CXXMethodDecl>(FD)->getParent(), ObjectType,
-                           ObjectClassification, Args.slice(1), CandidateSet,
+                           ObjectClassification, FunctionArgs, CandidateSet,
                            SuppressUserConversions, PartialOverloading);
----------------
cameron314 wrote:
> yvvan wrote:
> > cameron314 wrote:
> > > This breaks normal (non-static) method overload resolution, since the `this` argument is now passed to `AddMethodCandidate` which is not expecting it. It always thinks too many arguments are passed to methods with no parameters; most other calls to `AddMethodCandidate` in SemaOverload.cpp don't pass the implicit `this`.
> > This code is correct. It is sliced at line 6361 - only in the case when the args size is greater than 0.
> Hmm, you're right, I didn't see that. That line was missing after a rebase on our side, my fault for not properly cross-referencing the diffs. Sorry for the false alarm.
> 
> But shouldn't the slice only be done now when `Args.size() > 0 && (!Args[0] || (FirstArgumentIsBase && isa<CXXMethodDecl>(FD) && !isa<CXXConstructorDecl>(FD)))`?
there's already a check for this case that it's a CXXMethodDecl, it's not static. That means that we always need to slice (except those rare cases when we don't have any args, and in fact I don't know why these cases exist)


Repository:
  rL LLVM

https://reviews.llvm.org/D36390





More information about the cfe-commits mailing list