diff options
Diffstat (limited to 'clang/test')
3 files changed, 28 insertions, 4 deletions
diff --git a/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp b/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp index d6df2370ad9..5fb35ba9622 100644 --- a/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp +++ b/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp @@ -3,10 +3,10 @@ // When it is part of a parameter-declaration-clause, the parameter // pack is a function parameter pack. template<typename ...Types> -void f0(Types ...args); // FIXME: temporary expected-error{{clang does not yet support function parameter packs}} +void f0(Types ...args); template<typename ...Types> -void f1(const Types &...args); // FIXME: temporary expected-error{{clang does not yet support function parameter packs}} +void f1(const Types &...args); // [ Note: Otherwise, the parameter-declaration is part of a // template-parameter-list and the parameter pack is a template diff --git a/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp b/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp index 5f7de878087..1293a067576 100644 --- a/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp +++ b/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp @@ -20,8 +20,8 @@ template<typename T> struct is_same<T, T> { template<typename T, typename ...Types> struct X0 { - typedef identity<T(Types...)> function_pack_1; // expected-error{{clang does not yet support function parameter packs}} - typedef identity<T(Types......)> variadic_function_pack_1; // expected-error{{clang does not yet support function parameter packs}} + typedef identity<T(Types...)> function_pack_1; + typedef identity<T(Types......)> variadic_function_pack_1; typedef identity<T(T...)> variadic_1; typedef tuple<T(Types, ...)...> template_arg_expansion_1; }; diff --git a/clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp b/clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp index 5c0eb748756..f5453e08441 100644 --- a/clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp +++ b/clang/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp @@ -231,3 +231,27 @@ namespace TemplateTemplateApply { tuple<int&, int*, int const>>::value? 1 : -1]; } + +namespace FunctionTypes { + template<typename FunctionType> + struct Arity; + + template<typename R, typename ...Types> + struct Arity<R(Types...)> { + static const unsigned value = sizeof...(Types); + }; + + template<typename R, typename ...Types> + struct Arity<R(Types......)> { + static const unsigned value = sizeof...(Types); + }; + + template<typename R, typename T1, typename T2, typename T3, typename T4> + struct Arity<R(T1, T2, T3, T4)>; // expected-note{{template is declared here}} + + int check0[Arity<int()>::value == 0? 1 : -1]; + int check1[Arity<int(float, double)>::value == 2? 1 : -1]; + int check2[Arity<int(float...)>::value == 1? 1 : -1]; + int check3[Arity<int(float, double, long double...)>::value == 3? 1 : -1]; + Arity<int(float, double, long double, char)> check4; // expected-error{{implicit instantiation of undefined template 'FunctionTypes::Arity<int (float, double, long double, char)>'}} +} |