blob: fcfd9bcb7d9073fb1dd68170f82667c22b6d7b4d [file] [log] [blame]
Faisal Valifd5277c2013-08-22 01:49:11 +00001// RUN: %clang_cc1 -fsyntax-only -std=c++1y %s -verify -emit-llvm
2namespace 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
12namespace lambda_capturing {
13// FIXME: Once return type deduction is implemented for generic lambdas
14// this will need to be updated.
15void 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
25namespace nested_generic_lambdas {
26void 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
37namespace conversion_operator {
38void test() {
39 auto L = [](auto a) -> int { return a; };
40 int (*fp)(int) = L; //expected-error{{no viable conversion}}
41 }
42}
43
44namespace generic_lambda_as_default_argument_ok {
45 void test(int i = [](auto a)->int { return a; }(3)) {
46
47 }
48
49}
50