diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-11 03:14:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-11 03:14:20 +0000 |
commit | 21371ea7cf647f4f0f783faac325925cb8febb1c (patch) | |
tree | 0eb11a1193e03857a52ccba4478c0b83ce0424a3 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 55825aa2d88fe82bf3622f195046ae48532d3106 (diff) |
When mapping from a function parameter pack to the set of function
parameters it expanded to, map exactly the number of function
parameters that were expanded rather than just running to the end of
the instantiated parameter list. This finishes the implementation of
the last sentence of C++0x [temp.deduct.call]p1.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 50b24dc41d..a18bfbafc0 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1894,9 +1894,10 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D, // Parameter pack: make the instantiation an argument pack. SemaRef.CurrentInstantiationScope->MakeInstantiatedLocalArgPack( OldParam); - // FIXME: Variadic templates. Figure out how many arguments are in the - // expansion of OldParam, so we don't gobble all of the arguments here. - while (NewIdx < NumNewParams) { + unsigned NumArgumentsInExpansion + = SemaRef.getNumArgumentsInExpansion(OldParam->getType(), + TemplateArgs); + while (NumArgumentsInExpansion--) { ParmVarDecl *NewParam = NewProtoLoc->getArg(NewIdx++); Params.push_back(NewParam); SemaRef.CurrentInstantiationScope->InstantiatedLocalPackArg(OldParam, |