[clang] [Clang] Correctly construct template arguments for file-scope template template parameters (PR #76811)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 3 15:25:52 PST 2024


================
@@ -345,15 +345,19 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs(
 
   using namespace TemplateInstArgsHelpers;
   const Decl *CurDecl = ND;
+
+  if (!ND)
+    CurDecl = Decl::castFromDeclContext(DC);
+
   if (Innermost) {
     Result.addOuterTemplateArguments(const_cast<NamedDecl *>(ND),
                                      Innermost->asArray(), Final);
-    CurDecl = Response::UseNextDecl(ND).NextDecl;
+    if (CurDecl->getDeclContext()->isFileContext())
----------------
shafik wrote:

I feel like a comment here would be helpful.

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


More information about the cfe-commits mailing list