blob: 48c00aa7c6864552b4bff6e5c14ec88c8dd4d79b [file] [log] [blame]
Douglas Gregor89625492012-02-09 08:14:43 +00001// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
2
3// prvalue
4void 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
10namespace std {
11 class type_info;
12}
13
14struct P {
15 virtual ~P();
16};
17
18void 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
26template<typename T>
27struct 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
36void 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}