Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp2a/lambda-this1.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 // P0806R2 | |
2 // { dg-do compile } | |
3 // { dg-options "-std=c++2a" } | |
4 | |
5 struct X { | |
6 int x; | |
7 void foo (int n) { | |
8 auto a1 = [=] { x = n; }; // { dg-warning "implicit capture" } | |
9 auto a2 = [=, this] { x = n; }; | |
10 auto a3 = [=, *this]() mutable { x = n; }; | |
11 auto a4 = [&] { x = n; }; | |
12 auto a5 = [&, this] { x = n; }; | |
13 auto a6 = [&, *this]() mutable { x = n; }; | |
14 | |
15 auto a7 = [=] { // { dg-warning "implicit capture" } | |
16 auto a = [=] { // { dg-warning "implicit capture" } | |
17 auto a2 = [=] { x = n; }; // { dg-warning "implicit capture" } | |
18 }; | |
19 }; | |
20 | |
21 auto a8 = [=, this] { | |
22 auto a = [=, this] { | |
23 auto a2 = [=, this] { x = n; }; | |
24 }; | |
25 }; | |
26 | |
27 auto a9 = [=, *this]() mutable { | |
28 auto a = [=, *this]() mutable { | |
29 auto a2 = [=, *this]() mutable { x = n; }; | |
30 }; | |
31 }; | |
32 | |
33 auto a10 = [&] { | |
34 auto a = [&] { | |
35 auto a2 = [&] { x = n; }; | |
36 }; | |
37 }; | |
38 | |
39 auto a11 = [&, this] { | |
40 auto a = [&, this] { | |
41 auto a2 = [&, this] { x = n; }; | |
42 }; | |
43 }; | |
44 | |
45 auto a12 = [&, *this]() mutable { | |
46 auto a = [&, *this]() mutable { | |
47 auto a2 = [&, *this]() mutable { x = n; }; | |
48 }; | |
49 }; | |
50 } | |
51 }; |