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
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index a3b8b8e..786a13f 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5961,7 +5961,10 @@
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;
}