aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-03-03 02:41:12 +0000
committerDouglas Gregor <dgregor@apple.com>2011-03-03 02:41:12 +0000
commit67714230a191bc3c01f33378f34f34ef377991a6 (patch)
treebb2f9ffb665ee4d8372a331f329971cd07de651a /lib/Sema/SemaTemplate.cpp
parentdfbbcf964a5d51bc01340a6f830cf380f9c0a5a1 (diff)
When we use the default template arguments of a template template
parameter, save the instantiated default template arguments along with the explicitly-specified template argument list. That way, we prefer the default template template arguments corresponding to the template template parameter rather than those of its template template argument. This addresses the likely direction of C++ core issue 150, and fixes PR9353/<rdar://problem/9069136>, bringing us closer to the behavior of EDG and GCC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r--lib/Sema/SemaTemplate.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 49f9a1de1e..53d1a9e430 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -1631,7 +1631,7 @@ Sema::MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc,
QualType Sema::CheckTemplateIdType(TemplateName Name,
SourceLocation TemplateLoc,
- const TemplateArgumentListInfo &TemplateArgs) {
+ TemplateArgumentListInfo &TemplateArgs) {
TemplateDecl *Template = Name.getAsTemplateDecl();
if (!Template) {
// The template name does not resolve to a template, so we just
@@ -2535,7 +2535,7 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param,
/// for specializing the given template.
bool Sema::CheckTemplateArgumentList(TemplateDecl *Template,
SourceLocation TemplateLoc,
- const TemplateArgumentListInfo &TemplateArgs,
+ TemplateArgumentListInfo &TemplateArgs,
bool PartialTemplateArgs,
llvm::SmallVectorImpl<TemplateArgument> &Converted) {
TemplateParameterList *Params = Template->getTemplateParameters();
@@ -2573,6 +2573,7 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template,
// a template-id shall match the type and form specified for the
// corresponding parameter declared by the template in its
// template-parameter-list.
+ bool isTemplateTemplateParameter = isa<TemplateTemplateParmDecl>(Template);
llvm::SmallVector<TemplateArgument, 2> ArgumentPack;
TemplateParameterList::iterator Param = Params->begin(),
ParamEnd = Params->end();
@@ -2703,6 +2704,12 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template,
RAngleLoc, 0, Converted))
return true;
+ // Core issue 150 (assumed resolution): if this is a template template
+ // parameter, keep track of the default template arguments from the
+ // template definition.
+ if (isTemplateTemplateParameter)
+ TemplateArgs.addArgument(Arg);
+
// Move to the next template parameter and argument.
++Param;
++ArgIdx;
@@ -5002,7 +5009,7 @@ Sema::CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD,
/// this function specialization.
bool
Sema::CheckFunctionTemplateSpecialization(FunctionDecl *FD,
- const TemplateArgumentListInfo *ExplicitTemplateArgs,
+ TemplateArgumentListInfo *ExplicitTemplateArgs,
LookupResult &Previous) {
// The set of function template specializations that could match this
// explicit function template specialization.