annotate gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // Testcase from N2998
kono
parents:
diff changeset
2 // { dg-do compile { target c++11 } }
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 void f1(int i) {
kono
parents:
diff changeset
5 int const N = 20;
kono
parents:
diff changeset
6 auto m1 = [=]{
kono
parents:
diff changeset
7 int const M = 30;
kono
parents:
diff changeset
8 auto m2 = [i]{
kono
parents:
diff changeset
9 int x[N][M]; // OK: N and M are not "used"
kono
parents:
diff changeset
10 x[0][0] = i; // OK: i is explicitly captured by m2
kono
parents:
diff changeset
11 // and implicitly captured by m1
kono
parents:
diff changeset
12 };
kono
parents:
diff changeset
13 };
kono
parents:
diff changeset
14 struct s1 {
kono
parents:
diff changeset
15 int f;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
16 void work(int n) {
111
kono
parents:
diff changeset
17 int m = n*n;
kono
parents:
diff changeset
18 int j = 40;
kono
parents:
diff changeset
19 auto m3 = [this,m]{
kono
parents:
diff changeset
20 /*auto m4=*/[&,j]{ // { dg-error "j. is not captured" }
kono
parents:
diff changeset
21 int x = n; // { dg-error "n. is not captured" }
kono
parents:
diff changeset
22 x += m; // OK: m implicitly captured by m4
kono
parents:
diff changeset
23 // and explicitly captured by m3
kono
parents:
diff changeset
24 x += i; // { dg-error "i. is not captured" }
kono
parents:
diff changeset
25 x += f; // OK: this captured implicitly by m4
kono
parents:
diff changeset
26 // and explicitly by m3
kono
parents:
diff changeset
27 };
kono
parents:
diff changeset
28 };
kono
parents:
diff changeset
29 }
kono
parents:
diff changeset
30 };
kono
parents:
diff changeset
31 }