================
@@ -18629,18 +18669,24 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, 
Declarator &D,
         Diag(FD->getLocation(), 
diag::err_friend_decl_with_def_arg_must_be_def);
     }
 
-    // Mark templated-scope function declarations as unsupported.
-    if (!FD->getTemplateParameterLists().empty() && SS.isValid()) {
-      Diag(FD->getLocation(), diag::warn_template_qualified_friend_unsupported)
-        << SS.getScopeRep() << SS.getRange()
-        << cast<CXXRecordDecl>(CurContext);
-      FrD->setUnsupportedFriend(true);
+    ArrayRef<TemplateParameterList *> TPL = FD->getTemplateParameterLists();
+    FriendDecl *Friend;
+    if (TPL.size() > 0 && SS.isValid()) {
+      if (CheckTemplateDeclScope(S, TPL.back()))
+        return nullptr;
+
+      Friend =
+          FriendTemplateDecl::Create(Context, CurContext, D.getIdentifierLoc(),
+                                     ND, DS.getFriendSpecLoc(), TPL);
+    } else {
+      Friend = FriendDecl::Create(Context, CurContext, D.getIdentifierLoc(), 
ND,
+                                  DS.getFriendSpecLoc());
     }
-  }
 
-  warnOnReservedIdentifier(ND);
+    Friend->setAccess(AS_public);
+    CurContext->addDecl(Friend);
 
-  return ND;
+    return ND;
----------------
zwuis wrote:

Wrong indentation.

https://github.com/llvm/llvm-project/pull/191268
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to