diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-11 01:52:23 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-11 01:52:23 +0000 |
commit | 7d5c0c1273bdc1cb3dff1cb5a62d07b1439e82c7 (patch) | |
tree | 978f21cec876212e836022e75a4d1708d5aa4e88 /lib/Sema/SemaTemplateDeduction.cpp | |
parent | 4d484a753f38a231e17c364cba496f8c6d2d771e (diff) |
Implement the last bullet of [temp.deduct.type]p5 and part of the last
sentence of [temp.deduct.call]p1, both of which concern the
non-deducibility of parameter packs not at the end of a
parameter-type-list. The latter isn't fully implemented yet; see the
new FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateDeduction.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 842ad5c188..1bc24db27a 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -666,6 +666,13 @@ DeduceTemplateArguments(Sema &S, continue; } + // C++0x [temp.deduct.type]p5: + // The non-deduced contexts are: + // - A function parameter pack that does not occur at the end of the + // parameter-declaration-clause. + if (ParamIdx + 1 < NumParams) + return Sema::TDK_Success; + // C++0x [temp.deduct.type]p10: // If the parameter-declaration corresponding to Pi is a function // parameter pack, then the type of its declarator- id is compared with @@ -2483,7 +2490,12 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, // the call is compared with the type P of the declarator-id of the // function parameter pack. Each comparison deduces template arguments // for subsequent positions in the template parameter packs expanded by - // the function parameter pack. + // the function parameter pack. For a function parameter pack that does + // not occur at the end of the parameter-declaration-list, the type of + // the parameter pack is a non-deduced context. + if (ParamIdx + 1 < NumParams) + break; + QualType ParamPattern = ParamExpansion->getPattern(); llvm::SmallVector<unsigned, 2> PackIndices; { |