summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-10 07:32:04 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-10 07:32:04 +0000
commita8bac7f514ae46a7d4b26d05762ee799b78462ac (patch)
treebf0f230f837700c346bf9b48f9a61636364420e2 /clang/lib/Sema/SemaTemplate.cpp
parenteff85ad41b0d8886e587986944e9762bc1cf7b83 (diff)
downloadbcm5719-llvm-a8bac7f514ae46a7d4b26d05762ee799b78462ac.tar.gz
bcm5719-llvm-a8bac7f514ae46a7d4b26d05762ee799b78462ac.zip
Work-in-progress implementation of C++0x [temp.arg.explicit]p9, which
allows an argument pack determines via explicit specification of function template arguments to be extended by further, deduced arguments. For example: template<class ... Types> void f(Types ... values); void g() { f<int*, float*>(0, 0, 0); // Types is deduced to the sequence int*, float*, int } There are a number of FIXMEs in here that indicate places where we need to implement + test retained expansions, plus a number of other places in deduction where we need to correctly cope with the explicitly-specified arguments when deducing an argument pack. Furthermore, it appears that the RecursiveASTVisitor needs to be auditied; it's missing some traversals (especially w.r.t. template arguments) that cause it not to find unexpanded parameter packs when it should. The good news, however, is that the tr1::tuple implementation now works fully, and the tr1::bind example (both from N2080) is actually working now. llvm-svn: 123163
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 2c9a4307ed5..f540c7b9358 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -2550,10 +2550,13 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template,
// Form argument packs for each of the parameter packs remaining.
while (Param != ParamEnd) {
+ // If we're checking a partial list of template arguments, don't fill
+ // in arguments for non-template parameter packs.
+
if ((*Param)->isTemplateParameterPack()) {
- // The parameter pack takes the contents of the current argument pack,
- // which we built up earlier.
- if (ArgumentPack.empty()) {
+ if (PartialTemplateArgs && ArgumentPack.empty()) {
+ Converted.push_back(TemplateArgument());
+ } else if (ArgumentPack.empty()) {
Converted.push_back(TemplateArgument(0, 0));
} else {
TemplateArgument *PackedArgs
@@ -3600,7 +3603,7 @@ ExprResult
Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg,
SourceLocation Loc) {
assert(Arg.getKind() == TemplateArgument::Integral &&
- "Operation is only value for integral template arguments");
+ "Operation is only valid for integral template arguments");
QualType T = Arg.getIntegralType();
if (T->isCharType() || T->isWideCharType())
return Owned(new (Context) CharacterLiteral(
OpenPOWER on IntegriCloud