1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y
2
3 // prvalue
prvalue()4 void prvalue() {
5 auto&& x = [](auto a)->void { };
6 auto& y = [](auto *a)->void { }; // expected-error{{cannot bind to a temporary of type}}
7 }
8
9 namespace std {
10 class type_info;
11 }
12
13 struct P {
14 virtual ~P();
15 };
16
unevaluated_operand(P & p,int i)17 void 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)); // expected-warning {{expression with side effects will be evaluated despite being used as an operand to 'typeid'}}
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