aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda18.C
blob: c7ef8d0752e8ef3553b5c44050dc9bf3702bcb51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// PR c++/82570
// { dg-do compile { target c++17 } }

template< typename Body >
inline void iterate(Body body)
{
	body(10);
}

template< typename Pred >
inline void foo(Pred pred)
{
	iterate([&](int param)
	{
		if (pred(param))
		{
			unsigned char buf[4];
			buf[0] = 0;
			buf[1] = 1;
			buf[2] = 2;
			buf[3] = 3;
		}
	});
}

int main()
{
	foo([](int x) { return x > 0; });
	return 0;
}