[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

via cfe-commits cfe-commits at lists.llvm.org
Mon May 27 09:57:56 PDT 2024


================
@@ -7636,7 +7651,16 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl,
       // exist for each argument an implicit conversion sequence
       // (13.3.3.1) that converts that argument to the corresponding
       // parameter of F.
-      QualType ParamType = Proto->getParamType(ArgIdx + ExplicitOffset);
+      QualType ParamType;
+      if (CandidateSet.getKind() ==
+              OverloadCandidateSet::CSK_AddressOfOverloadSet &&
+          Method->isImplicitObjectMemberFunction()) {
----------------
Sirraide wrote:

>From what I can tell, this function checks this exact condition in several places, so we could maybe put sth. like this at the start of the function
```c++
bool AddImplicitObjectParam = 
    CandidateSet.getKind() == OverloadCandidateSet::CSK_AddressOfOverloadSet &&
    Method->isImplicitObjectMemberFunction()
```
and use that instead to make it a bit clearer that it’s really the same condition.

https://github.com/llvm/llvm-project/pull/93430


More information about the cfe-commits mailing list