diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-07-08 18:37:38 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-07-08 18:37:38 +0000 |
commit | 9961ce9428a935c33541936e019fc1e810b8c09f (patch) | |
tree | 7c779e661144d4da031256ce69841686907d06f7 /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 246549c50b6e2db6da277c607c3bfcb862a134ef (diff) | |
download | bcm5719-llvm-9961ce9428a935c33541936e019fc1e810b8c09f.tar.gz bcm5719-llvm-9961ce9428a935c33541936e019fc1e810b8c09f.zip |
When performing substitution of template arguments within the body of
a template, be sure to include the template arguments from the
injected-class-name. Fixes PR7587.
llvm-svn: 107895
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 897acf39cee..6db0916e445 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -63,7 +63,8 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D, if (ClassTemplateSpecializationDecl *Spec = dyn_cast<ClassTemplateSpecializationDecl>(Ctx)) { // We're done when we hit an explicit specialization. - if (Spec->getSpecializationKind() == TSK_ExplicitSpecialization) + if (Spec->getSpecializationKind() == TSK_ExplicitSpecialization && + !isa<ClassTemplatePartialSpecializationDecl>(Spec)) break; Result.addOuterTemplateArguments(&Spec->getTemplateInstantiationArgs()); @@ -104,6 +105,15 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D, RelativeToPrimary = false; continue; } + } else if (CXXRecordDecl *Rec = dyn_cast<CXXRecordDecl>(Ctx)) { + if (ClassTemplateDecl *ClassTemplate = Rec->getDescribedClassTemplate()) { + QualType T = ClassTemplate->getInjectedClassNameSpecialization(); + const TemplateSpecializationType *TST + = cast<TemplateSpecializationType>(Context.getCanonicalType(T)); + Result.addOuterTemplateArguments(TST->getArgs(), TST->getNumArgs()); + if (ClassTemplate->isMemberSpecialization()) + break; + } } Ctx = Ctx->getParent(); |