Avoid do drop outer template parameter lists on the floor.

llvm-svn: 127404
This commit is contained in:
Abramo Bagnara 2011-03-10 13:28:31 +00:00
parent 19fd03e277
commit 0adf29a5bd
4 changed files with 21 additions and 9 deletions

View File

@ -3184,7 +3184,9 @@ public:
IdentifierInfo *Name, SourceLocation NameLoc,
AttributeList *Attr,
TemplateParameterList *TemplateParams,
AccessSpecifier AS);
AccessSpecifier AS,
unsigned NumOuterTemplateParamLists,
TemplateParameterList **OuterTemplateParamLists);
void translateTemplateArguments(const ASTTemplateArgsPtr &In,
TemplateArgumentListInfo &Out);

View File

@ -6031,13 +6031,13 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
// be a member of another template).
if (Invalid)
return 0;
OwnedDecl = false;
DeclResult Result = CheckClassTemplate(S, TagSpec, TUK, KWLoc,
SS, Name, NameLoc, Attr,
TemplateParams,
AS);
TemplateParameterLists.release();
TemplateParams, AS,
NumMatchedTemplateParamLists,
(TemplateParameterList**) TemplateParameterLists.release());
return Result.get();
} else {
// The "template<>" header is extraneous.

View File

@ -6909,10 +6909,12 @@ Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc,
// This is a declaration of a class template.
if (Invalid)
return 0;
return CheckClassTemplate(S, TagSpec, TUK_Friend, TagLoc,
SS, Name, NameLoc, Attr,
TemplateParams, AS_public).take();
TemplateParams, AS_public,
NumMatchedTemplateParamLists,
(TemplateParameterList**) TempParamLists.release()).take();
} else {
// The "template<>" header is extraneous.
Diag(TemplateParams->getTemplateLoc(), diag::err_template_tag_noparams)

View File

@ -793,7 +793,9 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
IdentifierInfo *Name, SourceLocation NameLoc,
AttributeList *Attr,
TemplateParameterList *TemplateParams,
AccessSpecifier AS) {
AccessSpecifier AS,
unsigned NumOuterTemplateParamLists,
TemplateParameterList** OuterTemplateParamLists) {
assert(TemplateParams && TemplateParams->size() > 0 &&
"No template parameters");
assert(TUK != TUK_Reference && "Can only declare or define class templates");
@ -968,6 +970,10 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
PrevClassTemplate->getTemplatedDecl() : 0,
/*DelayTypeCreation=*/true);
SetNestedNameSpecifier(NewClass, SS);
if (NumOuterTemplateParamLists > 0)
NewClass->setTemplateParameterListsInfo(Context,
NumOuterTemplateParamLists,
OuterTemplateParamLists);
ClassTemplateDecl *NewTemplate
= ClassTemplateDecl::Create(Context, SemanticContext, NameLoc,
@ -4586,7 +4592,9 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
TemplateNameLoc,
Attr,
TemplateParams,
AS_none);
AS_none,
NumMatchedTemplateParamLists,
(TemplateParameterList**) TemplateParameterLists.release());
}
// Create a new class template partial specialization declaration node.