From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- .../temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp (limited to 'clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp') diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp new file mode 100644 index 0000000..81addfe --- /dev/null +++ b/clang/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +// 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); +} -- cgit v1.2.3