diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/ASTContext.cpp | 17 | ||||
-rw-r--r-- | lib/AST/DeclTemplate.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 1 |
3 files changed, 12 insertions, 8 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 7ed9e45fce..d97d2155c0 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1414,11 +1414,13 @@ QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl) { } /// \brief Retrieve the template type parameter type for a template -/// parameter with the given depth, index, and (optionally) name. +/// parameter or parameter pack with the given depth, index, and (optionally) +/// name. QualType ASTContext::getTemplateTypeParmType(unsigned Depth, unsigned Index, + bool ParameterPack, IdentifierInfo *Name) { llvm::FoldingSetNodeID ID; - TemplateTypeParmType::Profile(ID, Depth, Index, Name); + TemplateTypeParmType::Profile(ID, Depth, Index, ParameterPack, Name); void *InsertPos = 0; TemplateTypeParmType *TypeParm = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos); @@ -1426,11 +1428,12 @@ QualType ASTContext::getTemplateTypeParmType(unsigned Depth, unsigned Index, if (TypeParm) return QualType(TypeParm, 0); - if (Name) - TypeParm = new (*this, 8) TemplateTypeParmType(Depth, Index, Name, - getTemplateTypeParmType(Depth, Index)); - else - TypeParm = new (*this, 8) TemplateTypeParmType(Depth, Index); + if (Name) { + QualType Canon = getTemplateTypeParmType(Depth, Index, ParameterPack); + TypeParm = new (*this, 8) TemplateTypeParmType(Depth, Index, ParameterPack, + Name, Canon); + } else + TypeParm = new (*this, 8) TemplateTypeParmType(Depth, Index, ParameterPack); Types.push_back(TypeParm); TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos); diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index ea8dd0d3c0..23c2637875 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -190,7 +190,7 @@ TemplateTypeParmDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack) { - QualType Type = C.getTemplateTypeParmType(D, P, Id); + QualType Type = C.getTemplateTypeParmType(D, P, ParameterPack, Id); return new (C) TemplateTypeParmDecl(DC, L, Id, Typename, Type, ParameterPack); } diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 0a2934b1c8..31c048d74c 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -564,6 +564,7 @@ InstantiateTemplateTypeParmType(const TemplateTypeParmType *T, // parameter with the template "level" reduced by one. return SemaRef.Context.getTemplateTypeParmType(T->getDepth() - 1, T->getIndex(), + T->isParameterPack(), T->getName()) .getQualifiedType(Quals); } |