[clang] [Clang][Sema] Fix the lambda call expression inside of a type alias declaration (PR #82310)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 03:31:39 PST 2024


================
@@ -614,10 +614,14 @@ bool Sema::SetupConstraintScope(
     // reference the original primary template.
     // We walk up the instantiated template chain so that nested lambdas get
     // handled properly.
-    for (FunctionTemplateDecl *FromMemTempl =
-             PrimaryTemplate->getInstantiatedFromMemberTemplate();
-         FromMemTempl;
-         FromMemTempl = FromMemTempl->getInstantiatedFromMemberTemplate()) {
+    // Note that we shall not collect instantiated parameters from
+    // 'intermediate' transformed function templates but the primary template
+    // for which we have built up the template arguments relative to. Otherwise,
+    // we may have mismatched template parameter depth!
----------------
cor3ntin wrote:

```suggestion
    // We should only collect instantiated parameters from 
    // the primary template. Otherwise, we may have mismatched template parameter depth!
```

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


More information about the cfe-commits mailing list