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

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 23:58:23 PST 2024


================
@@ -345,15 +345,19 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs(
 
   using namespace TemplateInstArgsHelpers;
   const Decl *CurDecl = ND;
+
+  if (!ND)
----------------
zyn0217 wrote:

> Can we also get a comment here why this makes sense to call `Decl::castFromDeclContext(DC)` if `CurrDecl` is not present?

I think this has been explained in the comment above the function.
```cpp
/// \param DC In the event we don't HAVE a declaration yet, we instead provide
///  the decl context where it will be created.  In this case, the `Innermost`
///  should likely be provided.  If ND is non-null, this is ignored.
```

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


More information about the cfe-commits mailing list