diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2010-12-10 17:08:53 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2010-12-10 17:08:53 +0000 |
| commit | 0168763e7d90bad49714fd9db1f1b01326f20caf (patch) | |
| tree | 6cf79605650d08672709622e02a228e1e9db1bb1 /clang/lib/Sema | |
| parent | 352d5e5362caf625fe3830d9eb00efb6582dbda3 (diff) | |
| download | bcm5719-llvm-0168763e7d90bad49714fd9db1f1b01326f20caf.tar.gz bcm5719-llvm-0168763e7d90bad49714fd9db1f1b01326f20caf.zip | |
Do not substitute template types if template has dependent context
We should not substitute template types if the template has a dependent
context because the template argument stack is not yet fully formed.
Instead, defer substitution until the template has a non-dependent
context (i.e. instantiation of an outer template).
llvm-svn: 121491
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 7539a569653..53a02a98864 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2110,9 +2110,12 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, // Check non-type template parameters. if (NonTypeTemplateParmDecl *NTTP =dyn_cast<NonTypeTemplateParmDecl>(Param)) { // Do substitution on the type of the non-type template parameter - // with the template arguments we've seen thus far. + // with the template arguments we've seen thus far. But if the + // template has a dependent context then we cannot substitute yet. QualType NTTPType = NTTP->getType(); - if (NTTPType->isDependentType()) { + if (NTTPType->isDependentType() && + !isa<TemplateTemplateParmDecl>(Template) && + !Template->getDeclContext()->isDependentContext()) { // Do substitution on the type of the non-type template parameter. InstantiatingTemplate Inst(*this, TemplateLoc, Template, NTTP, Converted.data(), Converted.size(), |

