/cp
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / lambda-generic-variadic5.C
blob6dbb9c8e55be43aa1bf7c2652ad11f12baeca2d9
1 // PR c++/65949
2 // { dg-do compile { target c++14 } }
4 #include <initializer_list>
6 template<class T, class... Ts>
7 struct Over : T, Over<Ts...>::type
9     using type = Over;
11     Over(T f1, Ts... f2)
12         : T(f1), Over<Ts...>::type(f2...)
13     {
14     }
16     using T::operator();
17     using Over<Ts...>::type::operator();
20 template<class T>
21 struct Over<T> : T
23     using type = T;
24     using T::operator();
27 template <class... Lambdas>
28 auto CreateLambdas(Lambdas... lambdas)
30     return Over<Lambdas...>(lambdas...);
33 int main()
35     auto mesLambda = CreateLambdas
36     (
37         []()
38         {
40         },
42         [](auto i)
43         {
44           (void)i;
45         },
47         [](auto... args)
48         {
49             auto list = {args...};
51             for(auto &&a : list)
52               (void)a;
54             return 3;
55         }
56     );
58     mesLambda();
59     mesLambda(1);
60     mesLambda(12,24,36,48);