summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-30 23:23:59 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-30 23:23:59 +0000
commita477e2afe7e4c255797a9862a8be2bd75b430fd1 (patch)
treefb926fd12ab8113b8610078af9db754d4dd99abb /clang/lib
parentc910acb54a2f2b5fb3ccc028ef3b89ab203c150d (diff)
downloadbcm5719-llvm-a477e2afe7e4c255797a9862a8be2bd75b430fd1.tar.gz
bcm5719-llvm-a477e2afe7e4c255797a9862a8be2bd75b430fd1.zip
When template substitution into a template parameter reduces the level
of that parameter, reduce the level by the number of active template argument lists rather than by 1. The number of active template argument lists is only > 1 when we have a class template partial specialization of a member template of a class template that itself is a member template of another class template. ... and Boost.MSM does this. Fixes PR7669. llvm-svn: 112551
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 26fbe6a1148..2566d043080 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1461,8 +1461,8 @@ Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
TemplateTypeParmDecl *Inst =
TemplateTypeParmDecl::Create(SemaRef.Context, Owner, D->getLocation(),
- TTPT->getDepth() - 1, TTPT->getIndex(),
- TTPT->getName(),
+ TTPT->getDepth() - TemplateArgs.getNumLevels(),
+ TTPT->getIndex(),TTPT->getName(),
D->wasDeclaredWithTypename(),
D->isParameterPack());
@@ -1503,8 +1503,9 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
NonTypeTemplateParmDecl *Param
= NonTypeTemplateParmDecl::Create(SemaRef.Context, Owner, D->getLocation(),
- D->getDepth() - 1, D->getPosition(),
- D->getIdentifier(), T, DI);
+ D->getDepth() - TemplateArgs.getNumLevels(),
+ D->getPosition(), D->getIdentifier(), T,
+ DI);
if (Invalid)
Param->setInvalidDecl();
@@ -1534,8 +1535,9 @@ TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
// Build the template template parameter.
TemplateTemplateParmDecl *Param
= TemplateTemplateParmDecl::Create(SemaRef.Context, Owner, D->getLocation(),
- D->getDepth() - 1, D->getPosition(),
- D->getIdentifier(), InstParams);
+ D->getDepth() - TemplateArgs.getNumLevels(),
+ D->getPosition(), D->getIdentifier(),
+ InstParams);
Param->setDefaultArgument(D->getDefaultArgument(), false);
// Introduce this template parameter's instantiation into the instantiation
OpenPOWER on IntegriCloud