[ODRHash] Add TemplateArgument kind to hash.

llvm-svn: 305328
This commit is contained in:
Richard Trieu 2017-06-13 22:21:18 +00:00
parent 9c056c9e1b
commit 3b261bb725
2 changed files with 23 additions and 1 deletions

View File

@ -140,7 +140,11 @@ void ODRHash::AddTemplateName(TemplateName Name) {
}
}
void ODRHash::AddTemplateArgument(TemplateArgument TA) {}
void ODRHash::AddTemplateArgument(TemplateArgument TA) {
const auto Kind = TA.getKind();
ID.AddInteger(Kind);
}
void ODRHash::AddTemplateParameterList(const TemplateParameterList *TPL) {}
void ODRHash::clear() {

View File

@ -1002,6 +1002,24 @@ S2 s2;
#endif
}
namespace TemplateArgument {
#if defined(FIRST)
template <class> struct U1{};
struct S1 {
U1<int> x;
};
#elif defined(SECOND)
template <int> struct U1{};
struct S1 {
U1<1> x;
};
#else
S1 s1;
// expected-error@first.h:* {{'TemplateArgument::S1::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S1' in module 'SecondModule'}}
// expected-note@second.h:* {{declaration of 'x' does not match}}
#endif
}
// Interesting cases that should not cause errors. struct S should not error
// while struct T should error at the access specifier mismatch at the end.
namespace AllDecls {