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