From 4d06bef38d404253266c2e42209f6d036b04f0cc Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Tue, 13 Feb 2018 19:53:40 +0000 Subject: Update StmtProfile.cpp to handle zero template arguments. Treat having no templates arguments differently than having zero template arguments when profiling. llvm-svn: 325040 --- clang/test/Modules/odr_hash.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'clang/test') diff --git a/clang/test/Modules/odr_hash.cpp b/clang/test/Modules/odr_hash.cpp index 054e41a9eae..5991dd0a733 100644 --- a/clang/test/Modules/odr_hash.cpp +++ b/clang/test/Modules/odr_hash.cpp @@ -2924,6 +2924,21 @@ int I10 = F10(); // expected-note@first.h:* {{but in 'FirstModule' found a different body}} } // namespace FunctionDecl +namespace DeclTemplateArguments { +#if defined(FIRST) +int foo() { return 1; } +int bar() { return foo(); } +#elif defined(SECOND) +template +int foo() { return 2; } +int bar() { return foo<>(); } +#else +int num = bar(); +// expected-error@second.h:* {{'DeclTemplateArguments::bar' has different definitions in different modules; definition in module 'SecondModule' first difference is function body}} +// expected-note@first.h:* {{but in 'FirstModule' found a different body}} +#endif +} + // Keep macros contained to one file. #ifdef FIRST #undef FIRST -- cgit v1.2.3