This is some really old code (took me a while to find the test cases) & the
diagnostic text is slightly incorrect (it should really only apply to
re/declarations/, redefinitions are an error regardless of whether the types
match). Not sure if anyone cares about it, though.
For now this just makes the diagnostic more clear in less obvious cases where
the type of a declaration might not be explicitly written (eg: because it
uses decltype)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164313
91177308-0d34-0410-b5e6-
96231b3b80d8
def err_thread_non_thread : Error<
"thread-local declaration of %0 follows non-thread-local declaration">;
def err_redefinition_different_type : Error<
- "redefinition of %0 with a different type">;
+ "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
def err_redefinition_different_kind : Error<
"redefinition of %0 as different kind of symbol">;
def warn_forward_class_redefinition : Warning<
}
if (MergedT.isNull()) {
Diag(New->getLocation(), diag::err_redefinition_different_type)
- << New->getDeclName();
+ << New->getDeclName() << New->getType() << Old->getType();
Diag(Old->getLocation(), diag::note_previous_definition);
return New->setInvalidDecl();
}
enum e { e_1 };
extern int j[sizeof(enum e)]; // expected-note {{previous definition}}
-int j[42]; // expected-error {{redefinition of 'j' with a different type}}
+int j[42]; // expected-error {{redefinition of 'j' with a different type: 'int [42]' vs 'int [4]'}}
// rdar://6880104
_Decimal32 x; // expected-error {{GNU decimal type extension not supported}}