Faisal Vali | fd5277c | 2013-08-22 01:49:11 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++1y %s -verify -emit-llvm |
| 2 | namespace return_type_deduction_ok { |
| 3 | // FIXME: Once return type deduction is implemented for generic lambdas |
| 4 | // this will need to be updated. |
| 5 | auto l = [](auto a) ->auto { return a; }(2); |
| 6 | auto l2 = [](auto a) ->decltype(auto) { return a; }(2); |
| 7 | auto l3 = [](auto a) { return a; }(2); |
| 8 | |
| 9 | |
| 10 | } |
| 11 | |
| 12 | namespace lambda_capturing { |
| 13 | // FIXME: Once return type deduction is implemented for generic lambdas |
| 14 | // this will need to be updated. |
| 15 | void test() { |
| 16 | int i = 10; |
| 17 | auto L = [=](auto a) -> int { //expected-error{{unimplemented}} |
| 18 | return i + a; |
| 19 | }; |
| 20 | L(3); |
| 21 | } |
| 22 | |
| 23 | } |
| 24 | |
| 25 | namespace nested_generic_lambdas { |
| 26 | void test() { |
| 27 | auto L = [](auto a) -> int { |
| 28 | auto M = [](auto b, decltype(a) b2) -> int { //expected-error{{unimplemented}} |
| 29 | return 1; |
| 30 | }; |
| 31 | M(a, a); |
| 32 | }; |
| 33 | L(3); //expected-note{{in instantiation of}} |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | namespace conversion_operator { |
| 38 | void test() { |
| 39 | auto L = [](auto a) -> int { return a; }; |
| 40 | int (*fp)(int) = L; //expected-error{{no viable conversion}} |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | namespace generic_lambda_as_default_argument_ok { |
| 45 | void test(int i = [](auto a)->int { return a; }(3)) { |
| 46 | |
| 47 | } |
| 48 | |
| 49 | } |
| 50 | |