PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / lambda / lambda-deduce-ext-neg2.C
blobfdbb4e1e377de3315e2054dece6feef2308865c0
1 // Test that this is accepted even when pedantic now that it's part
2 // of the standard.
4 // { dg-do compile { target c++11 } }
5 // { dg-options "-pedantic" }
7 bool b;
8 template <class T>
9 T f (T t)
11   [=] { return t+1; };          // OK
12   return [=] {
13     auto i = t+1;
14     return i+1;
15   }();
18 int main()
20   if (f(1) != 3)
21     return 1;