summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.prim/expr.prim.lambda/generic-lambda-unimplemented-1y.cpp
blob: cd773b427812b3c35ab7196c3e7221926c4c274a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// RUN: %clang_cc1 -fsyntax-only -std=c++1y %s -verify -emit-llvm
namespace return_type_deduction_ok {
 auto l = [](auto a) ->auto { return a; }(2); 
 auto l2 = [](auto a) ->decltype(auto) { return a; }(2);  
 auto l3 = [](auto a) { return a; }(2); 

}

namespace lambda_capturing {
// FIXME: Once return type deduction is implemented for generic lambdas
// this will need to be updated.
void test() {
  int i = 10;
  auto L = [=](auto a) -> int { //expected-error{{unimplemented}}
    return i + a;
  };
  L(3); 
}

}

namespace nested_generic_lambdas {
void test() {
  auto L = [](auto a) -> int {
    auto M = [](auto b, decltype(a) b2) -> int { //expected-error{{unimplemented}}
      return 1;
    };
    M(a, a);
  };
  L(3); //expected-note{{in instantiation of}}
}
template<class T> void foo(T) {
 auto L = [](auto a) { return a; }; //expected-error{{unimplemented}}
}
template void foo(int); //expected-note{{in instantiation of}}
}

namespace conversion_operator {
void test() {
    auto L = [](auto a) -> int { return a; };
    int (*fp)(int) = L;  //expected-error{{no viable conversion}}
  }
}

namespace generic_lambda_as_default_argument_ok {
  void test(int i = [](auto a)->int { return a; }(3)) {
  
  }
  
}

OpenPOWER on IntegriCloud