Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp1z/constexpr-lambda18.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 // PR c++/82570 |
131 | 2 // { dg-do compile { target c++17 } } |
111 | 3 |
4 template< typename Body > | |
5 inline void iterate(Body body) | |
6 { | |
7 body(10); | |
8 } | |
9 | |
10 template< typename Pred > | |
11 inline void foo(Pred pred) | |
12 { | |
13 iterate([&](int param) | |
14 { | |
15 if (pred(param)) | |
16 { | |
17 unsigned char buf[4]; | |
18 buf[0] = 0; | |
19 buf[1] = 1; | |
20 buf[2] = 2; | |
21 buf[3] = 3; | |
22 } | |
23 }); | |
24 } | |
25 | |
26 int main() | |
27 { | |
28 foo([](int x) { return x > 0; }); | |
29 return 0; | |
30 } |