[clang] [Clang] skip shadow warnings for enum constants in distinct class scopes (PR #115656)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 03:57:04 PST 2024


================
@@ -8341,6 +8341,11 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
     // shadowing context, but that's just a false negative.
   }
 
+  // Skip shadowing check if we're in a class scope, dealing with an enum
+  // constant in a different context.
+  if (S->isClassScope() && isa<EnumConstantDecl>(D) &&
----------------
Fznamznon wrote:

Can we simply check that `NewDC->isRecord()` here instead of using a new `Scope` parameter?

https://github.com/llvm/llvm-project/pull/115656


More information about the cfe-commits mailing list