Skip to content
Snippets Groups Projects
Commit 5739844a authored by Richard Trieu's avatar Richard Trieu
Browse files

[ODRHash] Support Type TemplateArgument

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306904 91177308-0d34-0410-b5e6-96231b3b80d8
parent 7d6afdff
No related branches found
No related tags found
No related merge requests found
......@@ -146,7 +146,10 @@ void ODRHash::AddTemplateArgument(TemplateArgument TA) {
switch (Kind) {
case TemplateArgument::Null:
llvm_unreachable("Expected valid TemplateArgument");
case TemplateArgument::Type:
AddQualType(TA.getAsType());
break;
case TemplateArgument::Declaration:
case TemplateArgument::NullPtr:
case TemplateArgument::Integral:
......
......@@ -1070,6 +1070,40 @@ S4 s4;
// expected-error@first.h:* {{'TemplateArgument::S4::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S4' in module 'SecondModule'}}
// expected-note@second.h:* {{declaration of 'x' does not match}}
#endif
#if defined(FIRST)
template <class T> struct U5 {};
struct S5 {
U5<int> x;
};
#elif defined(SECOND)
template <class T> struct U5 {};
struct S5 {
U5<short> x;
};
#else
S5 s5;
// expected-error@first.h:* {{'TemplateArgument::S5::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S5' in module 'SecondModule'}}
// expected-note@second.h:* {{declaration of 'x' does not match}}
#endif
#if defined(FIRST)
template <class T> struct U6 {};
struct S6 {
U6<int> x;
U6<short> y;
};
#elif defined(SECOND)
template <class T> struct U6 {};
struct S6 {
U6<short> y;
U6<int> x;
};
#else
S6 s6;
// expected-error@second.h:* {{'TemplateArgument::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'y'}}
// expected-note@first.h:* {{but in 'FirstModule' found field 'x'}}
#endif
}
namespace TemplateTypeParmType {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment