diff options
author | Richard Trieu <rtrieu@google.com> | 2017-06-14 03:17:26 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2017-06-14 03:17:26 +0000 |
commit | ee132d6eb21e43b53951c715c8fef770dadd014e (patch) | |
tree | 46cb517d355a10f9773e45633f4358c999aa2c4b | |
parent | 1dcb405ca1e7963ffb63e42ca4c67795dc7ff411 (diff) | |
download | bcm5719-llvm-ee132d6eb21e43b53951c715c8fef770dadd014e.tar.gz bcm5719-llvm-ee132d6eb21e43b53951c715c8fef770dadd014e.zip |
[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.
llvm-svn: 305361
-rw-r--r-- | clang/lib/AST/ODRHash.cpp | 3 | ||||
-rw-r--r-- | clang/test/Modules/odr_hash.cpp | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp index 83355270c59..a1c2fbb0c4f 100644 --- a/clang/lib/AST/ODRHash.cpp +++ b/clang/lib/AST/ODRHash.cpp @@ -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; } } diff --git a/clang/test/Modules/odr_hash.cpp b/clang/test/Modules/odr_hash.cpp index 36f2e4bea00..51bd6269724 100644 --- a/clang/test/Modules/odr_hash.cpp +++ b/clang/test/Modules/odr_hash.cpp @@ -1051,6 +1051,24 @@ S3 s3; // expected-note@first.h:* {{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; +// 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 + } // Interesting cases that should not cause errors. struct S should not error |