[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 11 02:52:04 PDT 2025
================
@@ -8566,8 +8580,10 @@ void Sema::DiagnoseShadowingLambdaDecls(const LambdaScopeInfo *LSI) {
const NamedDecl *ShadowedDecl = Shadow.ShadowedDecl;
// Try to avoid the warning when the shadowed decl isn't captured.
const DeclContext *OldDC = ShadowedDecl->getDeclContext();
- if (const auto *VD = dyn_cast<VarDecl>(ShadowedDecl)) {
+ if (isa<VarDecl, BindingDecl>(ShadowedDecl)) {
+ const auto *VD = cast<ValueDecl>(ShadowedDecl);
SourceLocation CaptureLoc = getCaptureLocation(LSI, VD);
+
----------------
Fznamznon wrote:
```suggestion
```
https://github.com/llvm/llvm-project/pull/157667
More information about the cfe-commits
mailing list