================
@@ -1994,8 +1995,10 @@ 
TemplateDeclInstantiator::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
   // Link the instantiation back to the pattern *unless* this is a
   // non-definition friend declaration.
   if (!InstTemplate->getInstantiatedFromMemberTemplate() &&
-      !(isFriend && !D->getTemplatedDecl()->isThisDeclarationADefinition()))
+      !(isFriend && !D->getTemplatedDecl()->isThisDeclarationADefinition())) {
+    InstTemplate->setInstantiatedFromDefinition();
----------------
mizvekov wrote:

That's true, but the only problematic cases are the friends.

We could make the flag more accurate, as named, for non-friends, but then we 
don't have a motivation, and we would make searching for a declaration which is 
compatible with the definition slightly more expensive for those.

Another option is to rename the flag to something like 
`InstantiatedFromDefinitionForFriend`.

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