Skip to content

Commit 8debcdb

Browse files
committed
Addressing feedback.
1 parent ed64868 commit 8debcdb

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

clang/lib/Sema/SemaTemplateDeduction.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5805,22 +5805,18 @@ FunctionDecl *Sema::getMoreConstrainedFunction(FunctionDecl *FD1,
58055805
FunctionDecl *FD2) {
58065806
assert(!FD1->getDescribedTemplate() && !FD2->getDescribedTemplate() &&
58075807
"not for function templates");
5808-
5809-
auto getTemplatePattern = [](FunctionDecl *FD) {
5810-
// Specializations of conversion function templates are believed to be the
5811-
// only case where a function template specialization reaches here.
5812-
assert(!FD->isFunctionTemplateSpecialization() ||
5813-
isa<CXXConversionDecl>(FD));
5814-
5815-
if (FunctionDecl *MF = FD->getInstantiatedFromMemberFunction())
5816-
return MF;
5817-
else if (FunctionTemplateDecl *FTD = FD->getPrimaryTemplate())
5818-
return FTD->getTemplatedDecl();
5819-
5820-
return FD;
5821-
};
5822-
FunctionDecl *F1 = getTemplatePattern(FD1);
5823-
FunctionDecl *F2 = getTemplatePattern(FD2);
5808+
assert(!FD1->isFunctionTemplateSpecialization() ||
5809+
isa<CXXConversionDecl>(FD1));
5810+
assert(!FD2->isFunctionTemplateSpecialization() ||
5811+
isa<CXXConversionDecl>(FD2));
5812+
5813+
FunctionDecl *F1 = FD1;
5814+
if (FunctionDecl *P = FD1->getTemplateInstantiationPattern(false))
5815+
F1 = P;
5816+
5817+
FunctionDecl *F2 = FD2;
5818+
if (FunctionDecl *P = FD2->getTemplateInstantiationPattern(false))
5819+
F2 = P;
58245820

58255821
llvm::SmallVector<const Expr *, 1> AC1, AC2;
58265822
F1->getAssociatedConstraints(AC1);

0 commit comments

Comments
 (0)