================ @@ -5548,13 +5493,76 @@ static bool isAtLeastAsSpecializedAs(Sema &S, FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, - unsigned NumCallArguments2, bool Reversed) { + QualType RawObj1Ty, QualType RawObj2Ty, bool Reversed) { + SmallVector<QualType> Args1; + SmallVector<QualType> Args2; + const FunctionDecl *FD1 = FT1->getTemplatedDecl(); + const FunctionDecl *FD2 = FT2->getTemplatedDecl(); + bool shouldConvert1 = false; + bool shouldConvert2 = false; + QualType Obj1Ty; + QualType Obj2Ty; + 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); + // C++20 [temp.func.order]p3 + // [...] Each function template M that is a member function is + // considered to have a new first parameter of type + // X(M), described below, inserted in its function parameter list. + // + // Note that we interpret "that is a member function" as + // "that is a member function with no expicit object argument". + // Otherwise the ordering rules for methods with expicit objet arguments + // against anything else make no sense. + shouldConvert1 = Method1 && !Method1->isExplicitObjectMemberFunction(); + shouldConvert2 = Method2 && !Method2->isExplicitObjectMemberFunction(); ---------------- whisperity wrote:
```suggestion ShouldConvert1 = Method1 && !Method1->isExplicitObjectMemberFunction(); ShouldConvert2 = Method2 && !Method2->isExplicitObjectMemberFunction(); ``` Style nit formatting, if we're changing the code even though it might largely be a move/refactor, you can fix the formatting now! https://github.com/llvm/llvm-project/pull/83279 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits