gcc/testsuite/g++.dg/cpp1y/lambda-init19.C
raw| 1 | // PR c++/89767 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | void bar (int); |
| 5 | |
| 6 | void |
| 7 | foo () |
| 8 | { |
| 9 | int x = 0; |
| 10 | int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0; |
| 11 | auto z = [x, y = [x] { bar (x); }, x] { y (); bar (x); }; // { dg-error "already captured 'x' in lambda expression" } |
| 12 | auto w = [x, a, b, c, d, y = [x] { bar (x); }, e, f, g, h, x] { y (); bar (x + a + b + c + d + e + f + g + h); }; // { dg-error "already captured 'x' in lambda expression" } |
| 13 | z (); |
| 14 | w (); |
| 15 | } |