================
@@ -18069,6 +18069,34 @@ Decl 
*Sema::BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc,
   return Decl;
 }
 
+bool Sema::CheckDependentFriend(SourceLocation Loc, NestedNameSpecifier NNS,
+                                TemplateParameterList *FPL) {
+  if (!NNS || !FPL || FPL->size() == 0)
+    return false;
+
+  if (NNS.isDependent()) {
+    if (NNS.getKind() == NestedNameSpecifier::Kind::Type) {
+      QualType T(NNS.getCanonical().getAsType(), 0);
+
+      if (const auto *PIT = dyn_cast<PackIndexingType>(T))
+        T = PIT->getPattern();
+
+      if (const auto *TST = dyn_cast<TemplateSpecializationType>(T)) {
+        if (isa<ClassTemplateDecl>(TST->getTemplateName().getAsTemplateDecl()))
+          return false;
----------------
mizvekov wrote:

This could blow up if the template name is a DependentTemplateName or some 
other kind, For example `T::template X<int>`, you may want to add a 
corresponding test case, and change this to an `isa_and_not_null` check.

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