[clang] [clang-tools-extra] [Clang] support friend declarations with a dependent nested-name-specifier (PR #191268)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 21:59:46 PDT 2026


================
@@ -2441,6 +2442,44 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
   return false;
 }
 
+static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
+                                     FriendTemplateDecl *FTD1,
+                                     FriendTemplateDecl *FTD2) {
+  ArrayRef<TemplateParameterList *> TPL1 =
+      FTD1->getFriendTypeTemplateParameterLists();
+  ArrayRef<TemplateParameterList *> TPL2 =
+      FTD2->getFriendTypeTemplateParameterLists();
+  if (TPL1.size() != TPL2.size())
+    return false;
+
+  for (unsigned I = 0, N = TPL1.size(); I != N; ++I)
+    if (!IsStructurallyEquivalent(Context, TPL1[I], TPL2[I]))
+      return false;
----------------
zwuis wrote:

Use `llvm::equal`.

https://github.com/llvm/llvm-project/pull/191268


More information about the cfe-commits mailing list