Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested10.C

raw
1 // PR c++/110584
2 // { dg-do "run" { target c++11 } }
3
4 void foo (int i) {
5 if (i != 0)
6 __builtin_abort ();
7 }
8
9 int main () {
10 const int x = 0;
11
12 // We would error out on this.
13 (void) [&] () {
14 foo (x);
15 (void) [] () {
16 foo (x);
17 };
18 } ();
19 // As well as those.
20 (void) [&] () {
21 (void) [] () {
22 foo (x);
23 };
24 } ();
25 (void) [&x] () {
26 (void) [] () {
27 foo (x);
28 };
29 } ();
30 // But those would work already.
31 (void) [] () {
32 (void) [&] () {
33 foo (x);
34 };
35 } ();
36 (void) [&] () {
37 (void) [&] () {
38 foo (x);
39 };
40 } ();
41 (void) [=] () {
42 (void) [] () {
43 foo (x);
44 };
45 } ();
46 }