================
@@ -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())) {
----------------
AaronBallman wrote:

```suggestion
    if (const auto *MD =
            dyn_cast<CXXMethodDecl>(getFunctionLevelDeclContext())) {
```

https://github.com/llvm/llvm-project/pull/165919
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to