1 // { dg-do run { target c++11 } } 2 #include <cassert> 3 main()4int main() { 5 [] {}; 6 [] {} (); 7 [] () {}; 8 [] () {} (); 9 [] () { return "lambda"; }; 10 11 int i = 1, j = 2; 12 [&i, j] () { i = j; } (); 13 assert(i == 2); 14 assert(j == 2); 15 16 i = [] () { return 3; } (); 17 assert(i == 3); 18 19 int k = [&] () { return i; } (); 20 21 []{ return; }; 22 23 int array[] = { 1, 2, 3 }; 24 int* p = [&] () { return array; } (); 25 26 return 0; 27 } 28 29