1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify 2 3 // prvalue 4 void prvalue() { 5 auto&& x = []()->void { }; // expected-error{{lambda expressions are not supported yet}} 6 auto& y = []()->void { }; // expected-error{{cannot bind to a temporary of type}} \ 7 // expected-error{{lambda expressions are not supported yet}} 8 } 9 10 namespace std { 11 class type_info; 12 } 13 14 struct P { 15 virtual ~P(); 16 }; 17 18 void unevaluated_operand(P &p, int i) { 19 int i2 = sizeof([]()->void{}()); // expected-error{{lambda expression in an unevaluated operand}} \ 20 // expected-error{{lambda expressions are not supported yet}} 21 const std::type_info &ti1 = typeid([&]() -> P& { return p; }()); // expected-error{{lambda expressions are not supported yet}} 22 const std::type_info &ti2 = typeid([&]() -> int { return i; }()); // expected-error{{lambda expression in an unevaluated operand}} \ 23 // expected-error{{lambda expressions are not supported yet}} 24 } 25 26 template<typename T> 27 struct Boom { 28 Boom(const Boom&) { 29 T* x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} \ 30 // expected-error{{cannot initialize a variable of type 'float *' with an rvalue of type 'int'}} \ 31 // expected-error{{cannot initialize a variable of type 'double *' with an rvalue of type 'int'}} 32 } 33 void tickle() const; 34 }; 35 36 void odr_used(P &p, Boom<int> boom_int, Boom<float> boom_float, 37 Boom<double> boom_double) { 38 const std::type_info &ti1 39 = typeid([=,&p]() -> P& { boom_int.tickle(); return p; }()); // expected-error{{lambda expressions are not supported yet}} \ 40 // expected-note{{in instantiation of member function 'Boom<int>::Boom' requested here}} 41 const std::type_info &ti2 42 = typeid([=]() -> int { boom_float.tickle(); return 0; }()); // expected-error{{lambda expression in an unevaluated operand}} \ 43 // expected-error{{lambda expressions are not supported yet}} \ 44 // expected-note{{in instantiation of member function 'Boom<float>::Boom' requested here}} 45 46 auto foo = [=]() -> int { boom_double.tickle(); return 0; }; // expected-error{{lambda expressions are not supported yet}} \ 47 // expected-note{{in instantiation of member function 'Boom<double>::Boom' requested here}} 48 } 49