]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg2.C
merge in cxx0x-lambdas-branch@152308
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / cpp0x / lambda / lambda-deduce-ext-neg2.C
1 // Test that in pedantic mode, we warn about the extension to allow return
2 // type deduction when the lambda contains more than just a single
3 // return-statement.
4
5 // { dg-options "-std=c++0x -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; // { dg-warning "only statement" }
15 }();
16 }
17
18 int main()
19 {
20 if (f(1) != 3)
21 return 1;
22 }