[clang] [clang] Bugfix for choosing the more specialized overload (PR #83279)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 28 07:54:54 PST 2024
Botond =?utf-8?q?István_Horváth?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/83279 at github.com>
================
@@ -5548,13 +5514,113 @@ static bool isAtLeastAsSpecializedAs(Sema &S,
FunctionTemplateDecl *Sema::getMoreSpecializedTemplate(
FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc,
TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1,
- unsigned NumCallArguments2, bool Reversed) {
+ unsigned NumCallArguments2, QualType RawObjType1, QualType RawObjType2,
+ bool Reversed) {
+ SmallVector<QualType, 4> Args1;
+ SmallVector<QualType, 4> Args2;
+ const FunctionDecl *FD1 = FT1->getTemplatedDecl();
+ const FunctionDecl *FD2 = FT2->getTemplatedDecl();
+ bool shouldConvert1 = false;
+ bool shouldConvert2 = false;
+ QualType ObjType1;
+ QualType ObjType2;
+ if (TPOC == TPOC_Call) {
+ const FunctionProtoType *Proto1 =
+ FD1->getType()->getAs<FunctionProtoType>();
+ const FunctionProtoType *Proto2 =
+ FD2->getType()->getAs<FunctionProtoType>();
- bool Better1 = isAtLeastAsSpecializedAs(*this, Loc, FT1, FT2, TPOC,
- NumCallArguments1, Reversed);
- bool Better2 = isAtLeastAsSpecializedAs(*this, Loc, FT2, FT1, TPOC,
- NumCallArguments2, Reversed);
+ // - In the context of a function call, the function parameter types are
+ // used.
+ const CXXMethodDecl *Method1 = dyn_cast<CXXMethodDecl>(FD1);
+ const CXXMethodDecl *Method2 = dyn_cast<CXXMethodDecl>(FD2);
+
+ if (getLangOpts().CPlusPlus20) {
----------------
erichkeane wrote:
Same here, these two branches are REALLY similar and should probably be combined.
https://github.com/llvm/llvm-project/pull/83279
More information about the cfe-commits
mailing list