template<typename ...T> struct X {};
template<typename T, typename U> struct P {};
namespace Nested {
template<typename ...T> int f1(X<T, T...>... a); template<typename ...T> int f2(P<X<T...>, T> ...a);
int a1 = f1(X<int, int, double>(), X<double, int, double>());
int a2 = f1(X<int, int>());
int a3 = f1(X<int>(), X<double>()); int a4 = f1(X<int, int>(), X<int>()); int a5 = f1(X<int>(), X<int, int>()); int a6 = f1(X<int, int, int>(), X<int, int, int>(), X<int, int, int, int>());
int b1 = f2(P<X<int, double>, int>(), P<X<int, double>, double>());
int b2 = f2(P<X<int, double>, int>(), P<X<int, double>, double>(), P<X<int, double>, char>()); }
namespace PR14841 {
template<typename T, typename U> struct A {};
template<typename ...Ts> void f(A<Ts...>);
void g(A<char, short> a) {
f(a);
f<char>(a);
f<char, short>(a);
f<char, short, int>(a); }
}
namespace RetainExprPacks {
int f(int a, int b, int c);
template<typename ...Ts> struct X {};
template<typename ...Ts> int g(X<Ts...>, decltype(f(Ts()...)));
int n = g<int, int>(X<int, int, int>(), 0);
}
namespace PR14615 {
namespace comment0 {
template <class A, class...> struct X {};
template <class... B> struct X<int, B...> {
typedef int type;
struct valid {};
};
template <typename A, typename... B, typename T = X<A, B...>,
typename = typename T::valid>
typename T::type check(int);
int i = check<int, char>(1);
}
namespace comment2 {
template <class...> struct X;
template <typename... B, typename X<B...>::type I = 0>
char check(B...); void f() { check<char>(1, 2); } }
namespace comment3 {
template <class...> struct X;
template <typename... B, typename X<B...>::type I = (typename X<B...>::type)0>
char check(B...); void f() { check<char>(1, 2); } }
}
namespace fully_expanded_packs {
template<typename ...T> struct A {
template<T ...X> static constexpr int f() {
return (X + ... + 0); }
template<T ...X, int Y> static constexpr int g() {
return (X + ... + (1000 * Y)); }
template<T ...X, int Y, T ...Z> static constexpr int h() {
return (X + ... + (1000 * Y)) + 1000000 * (Z + ... + 0); }
template<T ...X, int ...Z> static constexpr int i() {
return (X + ... + 0) + 1000 * (Z + ... + 0); }
template<T ...X, int Y, int ...Z> static constexpr int j() {
return (X + ... + (1000 * Y)) + 1000000 * (Z + ... + 0); }
};
void check_invalid_calls() {
A<int, int>::f(); A<int, int>::f<>(); A<int, int>::f<0>(); A<int, int>::g(); A<int, int>::g<>(); A<int, int>::g<0>(); A<int, int>::g<0, 0>(); A<>::f<0>(); A<>::g(); A<>::g<>(); A<>::g<0, 0>(); A<>::h<>(); A<int>::h<>(); A<int>::h<0, 0>(); A<>::h<0, 0>(); }
static_assert(A<>::f() == 0, "");
static_assert(A<int>::f<1>() == 1, "");
static_assert(A<>::g<1>() == 1000, "");
static_assert(A<int>::g<1, 2>() == 2001, "");
static_assert(A<>::h<1>() == 1000, "");
static_assert(A<int>::h<1, 2, 3>() == 3002001, "");
static_assert(A<int, int>::h<1, 20, 3, 4, 50>() == 54003021, "");
static_assert(A<>::i<1>() == 1000, "");
static_assert(A<int>::i<1>() == 1, "");
static_assert(A<>::j<1, 2, 30>() == 32001000, "");
static_assert(A<int>::j<1, 2, 3, 40>() == 43002001, "");
}
namespace partial_full_mix {
template<typename T, typename U> struct pair {};
template<typename ...T> struct tuple {};
template<typename ...T> struct A {
template<typename ...U> static pair<tuple<T...>, tuple<U...>> f(pair<T, U> ...p);
template<typename ...U> static pair<tuple<T...>, tuple<U...>> g(pair<T, U> ...p, ...);
template<typename ...U> static tuple<U...> h(tuple<pair<T, U>..., pair<int, int>>);
};
pair<tuple<int, float>, tuple<char, double>> k1 = A<int, float>().f<char>(pair<int, char>(), pair<float, double>());
pair<tuple<int, float>, tuple<char, double>> k2 = A<int, float>().f<char>(pair<int, char>(), pair<float, double>(), pair<void, long>()); pair<tuple<int, float>, tuple<char, double>> k3 = A<int, float>().f<char, double, void>(pair<int, char>(), pair<float, double>());
pair<tuple<int, float>, tuple<char, double>> k4 = A<int, float>().g<char>(pair<int, char>(), pair<float, double>(), pair<void, long>());
tuple<int[2], int[4]> k5 = A<int[1], int[3]>::h<int[2]>(tuple<pair<int[1], int[2]>, pair<int[3], int[4]>, pair<int, int>>()); }
namespace substitution_vs_function_deduction {
template <typename... T> struct A {
template <typename... U> void f(void(*...)(T, U)); template <typename... U> void g(void...(T, U)); };
void f(int, int) {
A<int>().f(f);
A<int>().g(f); }
}
namespace Nested_Explicit_Specialization {
template <typename>
struct Outer {
template <int>
struct Inner;
template <>
struct Inner<0> {
template <typename... Args>
void Test(Args...) {}
};
};
void Run() {
Outer<void>::Inner<0>().Test(1,1);
}
}