111
|
1 // PR c++/65949
|
|
2 // { dg-do compile { target c++14 } }
|
|
3
|
|
4 #include <initializer_list>
|
|
5
|
|
6 template<class T, class... Ts>
|
|
7 struct Over : T, Over<Ts...>::type
|
|
8 {
|
|
9 using type = Over;
|
|
10
|
|
11 Over(T f1, Ts... f2)
|
|
12 : T(f1), Over<Ts...>::type(f2...)
|
|
13 {
|
|
14 }
|
|
15
|
|
16 using T::operator();
|
|
17 using Over<Ts...>::type::operator();
|
|
18 };
|
|
19
|
|
20 template<class T>
|
|
21 struct Over<T> : T
|
|
22 {
|
|
23 using type = T;
|
|
24 using T::operator();
|
|
25 };
|
|
26
|
|
27 template <class... Lambdas>
|
|
28 auto CreateLambdas(Lambdas... lambdas)
|
|
29 {
|
|
30 return Over<Lambdas...>(lambdas...);
|
|
31 }
|
|
32
|
|
33 int main()
|
|
34 {
|
|
35 auto mesLambda = CreateLambdas
|
|
36 (
|
|
37 []()
|
|
38 {
|
|
39
|
|
40 },
|
|
41
|
|
42 [](auto i)
|
|
43 {
|
|
44 (void)i;
|
|
45 },
|
|
46
|
|
47 [](auto... args)
|
|
48 {
|
|
49 auto list = {args...};
|
|
50
|
|
51 for(auto &&a : list)
|
|
52 (void)a;
|
|
53
|
|
54 return 3;
|
|
55 }
|
|
56 );
|
|
57
|
|
58 mesLambda();
|
|
59 mesLambda(1);
|
|
60 mesLambda(12,24,36,48);
|
|
61 }
|