[clang] [Clang] Fix a wrong diagnostic about a local variable inside a lambda in unevaluated context need capture (PR #165098)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 29 20:26:32 PDT 2025
================
@@ -7061,8 +7061,15 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
// anonymous unions in class templates).
}
- if (!ParentDependsOnArgs)
+ if (!ParentDependsOnArgs) {
+ if (auto Found =
+ CurrentInstantiationScope
+ ? CurrentInstantiationScope->getInstantiationOfIfExists(D)
+ : nullptr) {
+ return cast<NamedDecl>(Found->dyn_cast<Decl *>());
----------------
ojhunt wrote:
`cast_or_null` would be appropriate
https://github.com/llvm/llvm-project/pull/165098
More information about the cfe-commits
mailing list