aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/lambda-init4.C
blob: 0affb31bd5eda78c86229bb1dc309759c66c1b54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// N3648: capture init example from paper
// { dg-do run { target c++1y } }

int x = 4;
auto y = [&r = x, x = x+1]()->int {
  r += 2;
  return x+2;
}();  // Updates ::x to 6, and initializes y to 7.

int main()
{
  if (x != 6 || y != 7) __builtin_abort();
}