[clang] [Clang] Fix a wrong diagnostic about a local variable inside a lambda in unevaluated context need capture (PR #165098)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 27 08:08:54 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) {
----------------
Fznamznon wrote:
I find ternary operator inside of an if uncommon, can we simply do
```suggestion
if (CurrentInstantiationScope) {
llvm::PointerUnion<... > * Found = CurrentInstantiationScope->getInstantiationOfIfExists(D)
...
```
and spell out the type?
https://github.com/llvm/llvm-project/pull/165098
More information about the cfe-commits
mailing list