[PATCH] D36390: Fix overloaded static functions in SemaCodeComplete

Ivan Donchevskii via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 01:16:08 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:
> 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.


================
Comment at: cfe/trunk/lib/Sema/SemaOverload.cpp:6396
       } else {
         AddTemplateOverloadCandidate(FunTmpl, F.getPair(),
                                      ExplicitTemplateArgs, Args,
----------------
cameron314 wrote:
> The same slice that was added above needs to be done here for templated static methods that are accessed via a non-static object.
It might be the case. You can add that :)
I did not check template cases in details.


Repository:
  rL LLVM

https://reviews.llvm.org/D36390





More information about the cfe-commits mailing list