[clang] [Clang] prevent assertion failure by avoiding always-dependent lambdas in constraint-related nested scopes (PR #173776)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 7 10:17:12 PST 2026
================
@@ -1113,10 +1113,14 @@ void Sema::ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro,
// The parameter var is not injected into the function Decl at the point of
// parsing lambda. In such scenarios, perceiving it as dependent could
// result in the constraint being evaluated, which matches what GCC does.
- while (P->getEntity() && P->getEntity()->isRequiresExprBody())
- P = P->getParent();
- if (P->isFunctionDeclarationScope() &&
- llvm::any_of(P->decls(), [](Decl *D) {
+ Scope *LookupScope = ParentScope;
+ while (LookupScope->getEntity() &&
+ LookupScope->getEntity()->isRequiresExprBody())
----------------
shafik wrote:
Please, do the follow-up here. Code duplication is a bug magnet (maily b/c duplicative code often ends up not staying in sync) and we want to reduce it as much as possible.
https://github.com/llvm/llvm-project/pull/173776
More information about the cfe-commits
mailing list