blob: cc5cc540217d2c9a39da4836d9a83153f5cf3a2c (
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
|
// { dg-do run }
// { dg-options "-std=c++0x" }
#include <cassert>
int main() {
[] {};
[] {} ();
[] () {};
[] () {} ();
[] () { return "lambda"; };
int i = 1, j = 2;
[&i, j] () { i = j; } ();
assert(i == 2);
assert(j == 2);
i = [] () { return 3; } ();
assert(i == 3);
int k = [&] () { return i; } ();
[]{ return; };
int array[] = { 1, 2, 3 };
int* p = [&] () { return array; } ();
return 0;
}
|