// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // expected-no-diagnostics // Metafunction to extract the Nth type from a set of types. template struct get_nth_type; template struct get_nth_type : get_nth_type { }; template struct get_nth_type<0, Head, Tail...> { typedef Head type; }; // Placeholder type when get_nth_type fails. struct no_type {}; template struct get_nth_type { typedef no_type type; }; template typename get_nth_type<0, Args...>::type first_arg(Args...); template typename get_nth_type<1, Args...>::type second_arg(Args...); // Test explicit specification of function template arguments. void test_explicit_spec_simple() { int *ip1 = first_arg(0); int *ip2 = first_arg(0, 0); float *fp1 = first_arg(0, 0, 0); } // Template argument deduction can extend the sequence of template // arguments corresponding to a template parameter pack, even when the // sequence contains explicitly specified template arguments. void test_explicit_spec_extension(double *dp) { int *ip1 = first_arg(0, 0); int *ip2 = first_arg(0, 0, 0, 0); float *fp1 = first_arg(0, 0, 0); int *i1 = second_arg(0, (int*)0, 0); double *dp1 = first_arg<>(dp); } template struct tuple { }; template void accept_tuple(tuple); void test_explicit_spec_extension_targs(tuple t3) { accept_tuple(t3); accept_tuple(t3); accept_tuple(t3); accept_tuple(t3); } template void accept_function_ptr(R(*)(ParmTypes...)); void test_explicit_spec_extension_funcparms(int (*f3)(int, float, double)) { accept_function_ptr(f3); accept_function_ptr(f3); accept_function_ptr(f3); accept_function_ptr(f3); accept_function_ptr(f3); }