diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-07-01 00:28:38 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-07-01 00:28:38 +0000 |
commit | 16134c62ef3d146e0dd0c76aafb906ff12c0a15d (patch) | |
tree | 26dc8e696987010c71d8423aece3da4aa3a9862a /lib/Sema/SemaTemplateDeduction.cpp | |
parent | 6db8ed4498b83fe9336e3855a4ba1a298b04ee00 (diff) |
Cope with explicitly-specified function template arguments when there
are fewer template arguments than there are template parameters for
that function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74578 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateDeduction.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 810de048c2..ae0e704065 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -934,21 +934,24 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, // there are corresponding template-parameters. TemplateArgumentListBuilder Builder(TemplateParams, NumExplicitTemplateArgs); + + // Enter a new template instantiation context where we check the + // explicitly-specified template arguments against this function template, + // and then substitute them into the function parameter types. + InstantiatingTemplate Inst(*this, FunctionTemplate->getLocation(), + FunctionTemplate, Deduced.data(), Deduced.size()); + if (Inst) + return TDK_InstantiationDepth; + if (CheckTemplateArgumentList(FunctionTemplate, SourceLocation(), SourceLocation(), ExplicitTemplateArgs, NumExplicitTemplateArgs, SourceLocation(), + true, Builder) || Trap.hasErrorOccurred()) return TDK_InvalidExplicitArguments; - // Enter a new template instantiation context for the substitution of the - // explicitly-specified template arguments into the - InstantiatingTemplate Inst(*this, FunctionTemplate->getLocation(), - FunctionTemplate, Deduced.data(), Deduced.size()); - if (Inst) - return TDK_InstantiationDepth; - // Form the template argument list from the explicitly-specified // template arguments. TemplateArgumentList *ExplicitArgumentList |