================
@@ -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())
----------------
ojhunt wrote:
We could also have an additional filter parameter defaulted to
`[](auto*){return true;}` or similar? Maybe an additional Scope Kind flag along
the lines of (Github comment coding, probably doesn't compile, etc)
```cpp
// Scope::ScopeFlags having an "All" option might be nice?
template <Scope::ScopeFlags ScopeFlags=(Scope::ScopeFlags)0xFFFFFFFFFF>
DeclContext *getFilteredParent(auto Filter) {
auto FilterScope = [&](Scope *S) {
if (!(ScopeFlags & S->getFlags())) return false;
if constexpr requires (Filter(S)) {
return Filter(S);
} else {
if (DeclContext *Entity = S->getEntity())
return Filter(Entity);
}
return false;
};
while (!FilterFlags(S))
S = S->getParent();
return S;
}
template <Scope::ScopeFlags ScopeFlags=(Scope::ScopeFlags)0xFFFFFFFFFF>
DeclContext *getParentIgnoringTransparent(auto Filter = [](auto *){return
true;}) {
return getFilteredParent([&](Scope *S){
DeclContext *Entity = S->getEntity();
if (Entity && Entity->isTransparentContext())
return true;
if constexpr requires (Filter(Entity)) {
if (!Entity)
return false;
return Filter(Entity);
} else {
return Filter(S);
}
});
}
```
https://github.com/llvm/llvm-project/pull/173776
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits