summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2017-10-24 01:39:56 +0000
committerErich Keane <erich.keane@intel.com>2017-10-24 01:39:56 +0000
commitaf0795b906f372be504a7eb499ffe44d83fa1666 (patch)
tree8adbb69cb28811e1c23dbd5f7191a82cc6e59492
parent9ce2d03e5421979f9f007ec01d5aa429c36822ed (diff)
downloadbcm5719-llvm-af0795b906f372be504a7eb499ffe44d83fa1666.tar.gz
bcm5719-llvm-af0795b906f372be504a7eb499ffe44d83fa1666.zip
Fix template parameter default args missed if redecled
This bug was found via self-build on lld, and worked around here: https://reviews.llvm.org/rL316180 The issue is that the 'using' causes the lookup to pick up the first decl. However, when setting inherited default parameters, we only update 'forward', not 'backward'. SO, only the newest param list has all the information about the default arguments. This patch ensures that the list of parameters we look through checks the newest decl's template parameter list so it doesn't miss a default. Differential Revision: https://reviews.llvm.org/D39127 llvm-svn: 316405
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 0930fdd653b..26b80f11fb4 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -4805,7 +4805,12 @@ bool Sema::CheckTemplateArgumentList(
// template.
TemplateArgumentListInfo NewArgs = TemplateArgs;
- TemplateParameterList *Params = Template->getTemplateParameters();
+ // Make sure we get the template parameter list from the most
+ // recentdeclaration, since that is the only one that has is guaranteed to
+ // have all the default template argument information.
+ TemplateParameterList *Params =
+ cast<TemplateDecl>(Template->getMostRecentDecl())
+ ->getTemplateParameters();
SourceLocation RAngleLoc = NewArgs.getRAngleLoc();
OpenPOWER on IntegriCloud