================
@@ -8508,10 +8525,17 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl
*ShadowedDecl,
return;
}
}
- if (const auto *VD = dyn_cast<VarDecl>(ShadowedDecl);
- VD && VD->hasLocalStorage()) {
- // A variable can't shadow a local variable in an enclosing scope, if
- // they are separated by a non-capturing declaration context.
+ // Apply scoping logic to both VarDecl and BindingDecl
+ bool shouldApplyScopingLogic = false;
+ if (const auto *VD = dyn_cast<VarDecl>(ShadowedDecl)) {
+ shouldApplyScopingLogic = VD->hasLocalStorage();
----------------
zwuis wrote:
Do we need to apply same logic to structured bindings?
https://github.com/llvm/llvm-project/pull/157667
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits