diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-05 19:54:12 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-05 19:54:12 +0000 |
commit | b9397108c54851ce5f807420093df7102d5806a8 (patch) | |
tree | 24bd805532c99dc27ed1bfbebb31cf3318e00657 /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 64ffd11d4909b002809a5fbcfd3efcc44e754ca7 (diff) | |
download | bcm5719-llvm-b9397108c54851ce5f807420093df7102d5806a8.tar.gz bcm5719-llvm-b9397108c54851ce5f807420093df7102d5806a8.zip |
Fix two issues with the substitution of template template parameters
when instantiating the declaration of a member template:
- Only check if the have a template template argument at a specific position
when we already know that we have template arguments at that level;
otherwise, we're substituting for a level-reduced template template
parameter.
- When trying to find an instantiated declaration for a template
template parameter, look into the instantiated scope. This was a
typo, where we had two checks for TemplateTypeParmDecl, one of
which should have been a TemplateTemplateParmDecl.
With these changes, tramp3d-v4 passes -fsyntax-only.
llvm-svn: 95421
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 5c5701ac792..ab66ef3dfdf 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -578,6 +578,14 @@ Decl *TemplateInstantiator::TransformDecl(Decl *D) { if (TemplateTemplateParmDecl *TTP = dyn_cast<TemplateTemplateParmDecl>(D)) { if (TTP->getDepth() < TemplateArgs.getNumLevels()) { + // If the corresponding template argument is NULL or non-existent, it's + // because we are performing instantiation from explicitly-specified + // template arguments in a function template, but there were some + // arguments left unspecified. + if (!TemplateArgs.hasTemplateArgument(TTP->getDepth(), + TTP->getPosition())) + return D; + TemplateName Template = TemplateArgs(TTP->getDepth(), TTP->getPosition()).getAsTemplate(); assert(!Template.isNull() && Template.getAsTemplateDecl() && @@ -585,14 +593,6 @@ Decl *TemplateInstantiator::TransformDecl(Decl *D) { return Template.getAsTemplateDecl(); } - // If the corresponding template argument is NULL or non-existent, it's - // because we are performing instantiation from explicitly-specified - // template arguments in a function template, but there were some - // arguments left unspecified. - if (!TemplateArgs.hasTemplateArgument(TTP->getDepth(), - TTP->getPosition())) - return D; - // Fall through to find the instantiated declaration for this template // template parameter. } |