gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg2.C
raw| 1 | // Test that this is accepted even when pedantic now that it's part |
| 2 | // of the standard. |
| 3 | |
| 4 | // { dg-do compile { target c++11 } } |
| 5 | // { dg-options "-pedantic" } |
| 6 | |
| 7 | bool b; |
| 8 | template <class T> |
| 9 | T f (T t) |
| 10 | { |
| 11 | [=] { return t+1; }; // OK |
| 12 | return [=] { |
| 13 | auto i = t+1; |
| 14 | return i+1; |
| 15 | }(); |
| 16 | } |
| 17 | |
| 18 | int main() |
| 19 | { |
| 20 | if (f(1) != 3) |
| 21 | return 1; |
| 22 | } |