================
@@ -5185,9 +5189,24 @@ void Sema::InstantiateFunctionDefinition(SourceLocation 
PointOfInstantiation,
     RebuildTypeSourceInfoForDefaultSpecialMembers();
     SetDeclDefaulted(Function, PatternDecl->getLocation());
   } else {
+    NamedDecl *ND = Function;
+    std::optional<ArrayRef<TemplateArgument>> Innermost;
+    if (auto *Primary = Function->getPrimaryTemplate();
+        Primary &&
+        !isGenericLambdaCallOperatorOrStaticInvokerSpecialization(Function)) {
+      ND = *llvm::find_if(Primary->redecls(),
+                          [](const RedeclarableTemplateDecl *RTD) {
+                            auto *FTD = cast<FunctionTemplateDecl>(RTD);
+                            return FTD->isInstantiatedFromDefinition() ||
+                                   FTD->isThisDeclarationADefinition();
+                          });
----------------
zyn0217 wrote:

Oh yeah, I think I was saying the iterator shouldn't be null.


https://github.com/llvm/llvm-project/pull/110387
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to