Improve the diagnostic when the fixed underlying type of a

redeclaration of an enum type differs from that of the original
declaration, from Daniel Wallin

llvm-svn: 120577
This commit is contained in:
Douglas Gregor 2010-12-01 16:10:38 +00:00
parent ec0e366163
commit 1a099ba4db
2 changed files with 5 additions and 2 deletions

View File

@ -879,7 +879,7 @@ def ext_enumerator_too_large : ExtWarn<
def err_enumerator_wrapped : Error<
"enumerator value %0 is not representable in the underlying type %1">;
def err_enum_redeclare_type_mismatch : Error<
"enumeration redeclared with different underlying type">;
"enumeration redeclared with different underlying type %0 (was %1)">;
def err_enum_redeclare_fixed_mismatch : Error<
"enumeration previously declared with %select{non|}0fixed underlying type">;
def err_enum_redeclare_scoped_mismatch : Error<

View File

@ -5961,7 +5961,10 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
T = QualType(EnumUnderlying.get<const Type*>(), 0);
if (!Context.hasSameUnqualifiedType(T, PrevEnum->getIntegerType())) {
Diag(KWLoc, diag::err_enum_redeclare_type_mismatch);
Diag(NameLoc.isValid() ? NameLoc : KWLoc,
diag::err_enum_redeclare_type_mismatch)
<< T
<< PrevEnum->getIntegerType();
Diag(PrevTagDecl->getLocation(), diag::note_previous_use);
return PrevTagDecl;
}