[clang] Don't mark lambda non-dependent if nested in a generic lambda. (PR #149121)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 16 08:46:47 PDT 2025
================
@@ -15512,6 +15512,8 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
DC = DC->getParent();
if ((getSema().isUnevaluatedContext() ||
getSema().isConstantEvaluatedContext()) &&
+ !(dyn_cast_or_null<CXXRecordDecl>(DC->getParent()) &&
----------------
erichkeane wrote:
We'd want to use `isa_and_present` (or `isa_and_nonnull` or w/e it is called) in this case.
That said, we probably would prefer to do something like extracting above the `if` a `const auto *RD = dyn_cast_if_present<CXXRecordDecl>(DC->getParent());` then changing the check to RD && RD->isGenericLambda()` (or perhaps BETTER, pulling that whole thing out to a separate boolean with a reasonable name, so you have a place to put a comment).
Which brings me to the last thing, I'd like a comment explaining WHY this check should be here, it looks enough out of place as to why this cannot be dependent.
https://github.com/llvm/llvm-project/pull/149121
More information about the cfe-commits
mailing list