forked from OSchip/llvm-project
Silence the -Wshadow warning for enumerators shadowing a type.
Amends r344259 so that enumerators shadowing types are not diagnosed, as shadowing under those circumstances is rarely (if ever) an issue in practice. llvm-svn: 344898
This commit is contained in:
parent
c6c894b88f
commit
a529bc3d26
|
@ -16295,7 +16295,7 @@ Decl *Sema::ActOnEnumConstant(Scope *S, Decl *theEnumDecl, Decl *lastEnumConst,
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -64,3 +64,10 @@ enum PR24718_1{pr24718}; // expected-note {{previous declaration is here}}
|
|||
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.
|
||||
};
|
||||
};
|
||||
|
|
|
@ -225,3 +225,10 @@ void f(int a) {
|
|||
|
||||
int PR24718;
|
||||
enum class X { PR24718 }; // Ok, not shadowing
|
||||
|
||||
struct PR24718_1;
|
||||
struct PR24718_2 {
|
||||
enum {
|
||||
PR24718_1 // Does not shadow a type.
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue