[clang] [Clang] fix false-positive lambda shadow diagnostics in explicit object member functions (PR #165919)
Oleksandr T. via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 6 09:01:54 PST 2025
================
@@ -8492,12 +8492,11 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
DeclContext *NewDC = D->getDeclContext();
if (FieldDecl *FD = dyn_cast<FieldDecl>(ShadowedDecl)) {
- if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(NewDC)) {
- // Fields are not shadowed by variables in C++ static methods.
- if (MD->isStatic())
- return;
-
- if (!MD->getParent()->isLambda() && MD->isExplicitObjectMemberFunction())
+ if (CXXMethodDecl *MD =
+ dyn_cast<CXXMethodDecl>(getFunctionLevelDeclContext())) {
----------------
a-tarasyuk wrote:
@AaronBallman Thanks for the review. I've updated to use `auto`
https://github.com/llvm/llvm-project/pull/165919
More information about the cfe-commits
mailing list