p2-generic-lambda-1y.cpp revision 651f13cea278ec967336033dd032faef0e9fc2ec
1// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y
2
3// prvalue
4void prvalue() {
5  auto&& x = [](auto a)->void { };
6  auto& y = [](auto *a)->void { }; // expected-error{{cannot bind to a temporary of type}}
7}
8
9namespace std {
10  class type_info;
11}
12
13struct P {
14  virtual ~P();
15};
16
17void unevaluated_operand(P &p, int i) { //expected-note{{declared here}}
18  // FIXME: this should only emit one error.
19  int i2 = sizeof([](auto a, auto b)->void{}(3, '4')); // expected-error{{lambda expression in an unevaluated operand}} \
20                                                       // expected-error{{invalid application of 'sizeof'}}
21  const std::type_info &ti1 = typeid([](auto &a) -> P& { static P p; return p; }(i));
22  const std::type_info &ti2 = typeid([](auto) -> int { return i; }(i));  // expected-error{{lambda expression in an unevaluated operand}}\
23                                                                         // expected-error{{cannot be implicitly captured}}\
24                                                                         // expected-note{{begins here}}
25}
26