Merged revisions 208012,208018-208019,208021,208023-208030,208033,208037,208040-20804...
[official-gcc.git] / main / gcc / testsuite / g++.dg / cpp1y / lambda-init4.C
blob0affb31bd5eda78c86229bb1dc309759c66c1b54
1 // N3648: capture init example from paper
2 // { dg-do run { target c++1y } }
4 int x = 4;
5 auto y = [&r = x, x = x+1]()->int {
6   r += 2;
7   return x+2;
8 }();  // Updates ::x to 6, and initializes y to 7.
10 int main()
12   if (x != 6 || y != 7) __builtin_abort();