Skip to content

Commit

Permalink
[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305361 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Weverything committed Jun 14, 2017
1 parent 5d7ff3b commit 3e9def3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/AST/ODRHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,16 @@ void ODRHash::AddTemplateArgument(TemplateArgument TA) {
case TemplateArgument::Declaration:
case TemplateArgument::NullPtr:
case TemplateArgument::Integral:
break;
case TemplateArgument::Template:
case TemplateArgument::TemplateExpansion:
AddTemplateName(TA.getAsTemplateOrTemplatePattern());
break;
case TemplateArgument::Expression:
AddStmt(TA.getAsExpr());
break;
case TemplateArgument::Pack:
llvm_unreachable("Pack");
break;
}
}
Expand Down
18 changes: 18 additions & 0 deletions test/Modules/odr_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,24 @@ S3 s3;
// [email protected]:* {{but in 'FirstModule' found type alias 'T' with different underlying type 'U3<2>'}}
#endif

#if defined(FIRST)
template<class> struct T4a {};
template <template <class> class T> struct U4 {};
struct S4 {
U4<T4a> x;
};
#elif defined(SECOND)
template<class> struct T4b {};
template <template <class> class T> struct U4 {};
struct S4 {
U4<T4b> x;
};
#else
S4 s4;
// [email protected]:* {{'TemplateArgument::S4::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S4' in module 'SecondModule'}}
// [email protected]:* {{declaration of 'x' does not match}}
#endif

}

// Interesting cases that should not cause errors. struct S should not error
Expand Down

0 comments on commit 3e9def3

Please sign in to comment.