[clang] [clang] function template non-call partial ordering fixes (PR #106829)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 31 02:36:02 PDT 2024
================
@@ -5635,123 +5627,95 @@ static bool isAtLeastAsSpecializedAs(Sema &S, SourceLocation Loc,
assert(Proto1 && Proto2 && "Function templates must have prototypes");
TemplateParameterList *TemplateParams = FT2->getTemplateParameters();
- SmallVector<DeducedTemplateArgument, 4> Deduced;
- Deduced.resize(TemplateParams->size());
+ SmallVector<DeducedTemplateArgument, 4> Deduced(TemplateParams->size());
- // C++0x [temp.deduct.partial]p3:
- // The types used to determine the ordering depend on the context in which
- // the partial ordering is done:
TemplateDeductionInfo Info(Loc);
- switch (TPOC) {
- case TPOC_Call: {
- llvm::SmallBitVector HasDeducedParam(Args2.size());
- if (DeduceTemplateArguments(
- S, TemplateParams, Args2.data(), Args2.size(), Args1.data(),
- Args1.size(), Info, Deduced, TDF_None, /*PartialOrdering=*/true,
- /*HasDeducedAnyParam=*/nullptr,
- &HasDeducedParam) != TemplateDeductionResult::Success)
- return false;
+ if (TPOC == TPOC_Other) {
+ // We wouldn't be partial ordering these candidates if these didn't match.
+ assert(Proto2->getMethodQuals() == Proto1->getMethodQuals());
+ assert(Proto2->getRefQualifier() == Proto1->getRefQualifier());
+ assert(Proto2->isVariadic() == Proto1->isVariadic());
----------------
cor3ntin wrote:
You could merge all these asserts and maybe add a message like "cannot partial order functions templates with different qualifiers while resolving their address"
https://github.com/llvm/llvm-project/pull/106829
More information about the cfe-commits
mailing list