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 | 0dd423ef334c9d7c2a69ceace7e8329e1f2f4932 (patch) | |
tree | 2caa3e336a07ed093fa1239d1c25b8fb08909a51 /clang/lib/Sema/SemaTemplateDeduction.cpp | |
parent | 0d771edeee525b2e5438e38c812af0c871133d0b (diff) | |
download | bcm5719-llvm-0dd423ef334c9d7c2a69ceace7e8329e1f2f4932.tar.gz bcm5719-llvm-0dd423ef334c9d7c2a69ceace7e8329e1f2f4932.zip |
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.
llvm-svn: 123210
Diffstat (limited to 'clang/lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateDeduction.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 842ad5c188c..1bc24db27aa 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/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; { |