gcc/testsuite/g++.dg/cpp1y/lambda-generic-nested1.C
raw| 1 | // PR c++/71386 |
| 2 | // { dg-do run { target c++14 } } |
| 3 | |
| 4 | template<class...XS> |
| 5 | auto List(XS...xs) |
| 6 | { |
| 7 | return [=](auto processList){return processList(xs...);}; |
| 8 | } |
| 9 | |
| 10 | auto l1 = List(42); |
| 11 | |
| 12 | int test (int a) |
| 13 | { |
| 14 | if (a != 42) |
| 15 | __builtin_abort (); |
| 16 | return 0; |
| 17 | } |
| 18 | |
| 19 | auto foo = [](auto... xs1) |
| 20 | { |
| 21 | return [=]() |
| 22 | { |
| 23 | return l1([=](auto) |
| 24 | { |
| 25 | return test (xs1...); |
| 26 | }); |
| 27 | }; |
| 28 | }; |
| 29 | |
| 30 | int main() |
| 31 | { |
| 32 | auto concat = l1(foo); |
| 33 | concat(); |
| 34 | } |