================ @@ -13252,6 +13273,33 @@ class AddressOfFunctionResolver { } } + void EliminateLessPartialOrderingConstrainedMatches() { + // C++ [over.over]p5: + // [...] Any given non-template function F0 is eliminated if the set + // contains a second non-template function that is more + // partial-ordering-constrained than F0. [...] + assert(Matches[0].second->getPrimaryTemplate() == nullptr && + "Call EliminateAllTemplateMatches() first"); + SmallVector<std::pair<DeclAccessPair, FunctionDecl *>, 4> Results; + Results.push_back(Matches[0]); + for (unsigned I = 1, N = Matches.size(); I < N; ++I) { + assert(Matches[I].second->getPrimaryTemplate() == nullptr); + FunctionDecl *F = getMorePartialOrderingConstrained( + S, Matches[I].second, Results[0].second, + /*IsFn1Reversed=*/false, + /*IsFn2Reversed=*/false); + if (!F) { + Results.push_back(Matches[I]); + continue; + } + if (F == Matches[I].second) { + Results.clear(); + Results.push_back(Matches[I]); + } + } + std::swap(Matches, Results); ---------------- mizvekov wrote:
Does this work if there are pairs of functions in the set which are not more constrained than the other both ways? Do we have existing tests which cover that? https://github.com/llvm/llvm-project/pull/127773 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits