]> granicus.if.org Git - clang/commit
Implement substitution of a function parameter pack for its set of
authorDouglas Gregor <dgregor@apple.com>
Fri, 7 Jan 2011 16:43:16 +0000 (16:43 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 7 Jan 2011 16:43:16 +0000 (16:43 +0000)
commit12c9c00024a01819e3a70ef6d951d32efaeb9312
tree0c6499b83aab17269756d4e65041d29374506256
parent170464b7c0a2c0c86f2821f14a46f0d540cb5e94
Implement substitution of a function parameter pack for its set of
instantiated function parameters, enabling instantiation of arbitrary
pack expansions involving function parameter packs. At this point, we
can now correctly compile a simple, variadic print() example:

  #include <iostream>
  #include <string>

  void print() {}

  template<typename Head, typename ...Tail>
  void print(const Head &head, const Tail &...tail) {
    std::cout << head;
    print(tail...);
  }

  int main() {
    std::string hello = "Hello";
    print(hello, ", world!", " ", 2011, '\n');
  }

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123000 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Sema/Sema.h
include/clang/Sema/Template.h
lib/Sema/SemaTemplateDeduction.cpp
lib/Sema/SemaTemplateInstantiate.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
lib/Sema/SemaTemplateVariadic.cpp
lib/Sema/TreeTransform.h
test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp
test/CXX/temp/temp.decls/temp.variadic/p2.cpp [new file with mode: 0644]
test/CXX/temp/temp.decls/temp.variadic/p5.cpp