@@ -5805,22 +5805,18 @@ FunctionDecl *Sema::getMoreConstrainedFunction(FunctionDecl *FD1,
5805
5805
FunctionDecl *FD2) {
5806
5806
assert (!FD1->getDescribedTemplate () && !FD2->getDescribedTemplate () &&
5807
5807
" 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;
5824
5820
5825
5821
llvm::SmallVector<const Expr *, 1 > AC1, AC2;
5826
5822
F1->getAssociatedConstraints (AC1);
0 commit comments