Currently, we do not check for enumerators that shadow other enumerators as part of -Wshadow, but gcc does provide such a diagnostic for this case. This is intended to catch shadowing issues like:
enum E1{e1};
void f(void) {
enum E2{e1};
}This patch addresses PR24718.
I don't think we should do this for scoped enums in C++, i.e. this should be fine:
int Foo; enum class X { Foo };Can you enclose this in if (!TheEnumDecl->isScoped()) and add a test? Other than that, LGTM!