[clang] [Clang][Sema] Fix last argument not being used when comparing function template specializations when one has an explicit object argument (PR #92263)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed May 15 21:33:17 PDT 2024


================
@@ -5591,7 +5592,11 @@ FunctionTemplateDecl *Sema::getMoreSpecializedTemplate(
                                               IsRValRef1);
       Args2.push_back(Obj2Ty);
     }
-    size_t NumComparedArguments = NumCallArguments1 + ShouldConvert1;
+    size_t NumComparedArguments = NumCallArguments1;
+    // Either added an argument above or the prototype includes an explicit
+    // object argument we need to count
+    if (Method1)
+      ++NumComparedArguments;
----------------
mizvekov wrote:

It seems like changing the `ExplicitCallArguments` member of `OverloadCandidate` into just `CallArguments` might simplify this whole thing.

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


More information about the cfe-commits mailing list