[clang] [Clang] Account for the template depth of generic lambdas in default template arguments (PR #222541)

Akash Manna via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 07:12:15 PDT 2026


================
@@ -16304,11 +16308,13 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
   // (A ClassTemplateSpecializationDecl is always a dependent context.)
   while (DC->isRequiresExprBody() || isa<CXXExpansionStmtDecl>(DC))
     DC = DC->getParent();
-  if ((getSema().isUnevaluatedContext() ||
-       getSema().isConstantEvaluatedContext()) &&
-      !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
-        cast<CXXRecordDecl>(DC->getParent())->isGenericLambda()) &&
-      (DC->isFileContext() || !DC->getParent()->isDependentContext()))
+  if (getDerived().IsLambdaAlwaysDependent())
+    DependencyKind = CXXRecordDecl::LDK_AlwaysDependent;
----------------
akash-manna-sky wrote:

Right,
I’ve fixed by preserving the correct template-argument levels through deduction and instantiation, including for generic lambda specializations and their constraints.  I’ve added it to the test. I also updated the title and description.

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


More information about the cfe-commits mailing list