1// { dg-do compile { target c++11 } } 2 3template<typename T, typename U> struct is_same { 4 static const bool value = false; 5}; 6 7template<typename T> struct is_same<T, T> { 8 static const bool value = true; 9}; 10 11template<typename...> struct Tuple {}; 12template<typename T1, typename T2> struct Pair {}; 13 14template<typename... Args1> 15 struct zip { 16 template<typename... Args2> 17 struct with { 18 typedef Tuple<Pair<Args1, Args2>...> type; // { dg-error "mismatched argument pack" } 19 }; 20 }; 21 22static_assert 23 (is_same<zip<short, int>::with<unsigned short, unsigned>::type, 24 Tuple<Pair<short, unsigned short>, Pair<int, unsigned> > >::value, 25 "zip"); 26 27typedef zip<short>::with<unsigned short, unsigned>::type T2; // error: different number of arguments specified 28 // for Args1 and Args2 29 30template<typename... Args> void f(Args...); 31 32template<typename... Args> void g(Args... args) 33{ 34 f(const_cast<const Args*>(&args)...); // okay: ``Args'' and ``args'' are expanded 35 f(5 ...); // { dg-error "contains no argument packs" } 36 f(args); // { dg-error "parameter packs not expanded" } 37 // { dg-message "args" "note" { target *-*-* } 36 } 38 f(h(args...) + args...); // okay: first ``args'' expanded within h, second ``args'' expanded within f. 39} 40