================
@@ -18319,6 +18319,18 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, 
Declarator &D,
       DiagnoseUnexpandedParameterPack(SS, UPPC_FriendDeclaration))
     return nullptr;
 
+  if (D.isFunctionDefinition() && SS.isNotEmpty()) {
+    auto Kind = SS.getScopeRep().getKind();
+    if (Kind == NestedNameSpecifier::Kind::Global ||
+        Kind == NestedNameSpecifier::Kind::Namespace) {
+      if (D.getName().getKind() != UnqualifiedIdKind::IK_TemplateId) {
+        Diag(SS.getRange().getBegin(), diag::err_qualified_friend_def)
+            << SS.getScopeRep() << FixItHint::CreateRemoval(SS.getRange());
+        SS.clear();
+      }
+    }
+  }
----------------
Serosh-commits wrote:

> I would suggest/request putting the condition into its own 
> variable/function/etc.  It is REALLY hard to figure out what it is actually 
> checking here, and adding some names will be helpful.

yeah no problem Thanks for the suggestion 😊 erich no need for requesting ur 
suggestions are always helpful to me thanks 😃

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

Reply via email to