blob: d791ed60cfca45fcd7141519bfa5346245ada4ab [file] [log] [blame]
David Majnemerb1004102014-03-02 18:46:05 +00001// 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'}}
Aaron Ballman6c93b3e2014-12-17 21:57:17 +000021 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'}}
David Majnemerb1004102014-03-02 18:46:05 +000022 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}