Amends r344259 so that enumerators shadowing types are not diagnosed, as shadowing under those circumstances is rarely (if ever) an issue in practice.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344898
91177308-0d34-0410-b5e6-
96231b3b80d8
return nullptr;
if (PrevDecl) {
- if (!TheEnumDecl->isScoped()) {
+ if (!TheEnumDecl->isScoped() && isa<ValueDecl>(PrevDecl)) {
// Check for other kinds of shadowing not already handled.
CheckShadow(New, PrevDecl, R);
}
void PR24718(void) {
enum PR24718_2{pr24718}; // expected-warning {{declaration shadows a variable in the global scope}}
}
+
+struct PR24718_3;
+struct PR24718_4 {
+ enum {
+ PR24718_3 // Does not shadow a type.
+ };
+};
int PR24718;
enum class X { PR24718 }; // Ok, not shadowing
+
+struct PR24718_1;
+struct PR24718_2 {
+ enum {
+ PR24718_1 // Does not shadow a type.
+ };
+};