1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wno-unused-value %s -verify
5 auto&& x
= []()->void { };
6 auto& y
= []()->void { }; // expected-error{{cannot bind to a temporary of type}}
17 void unevaluated_operand(P
&p
, int i
) {
18 int i2
= sizeof([] ()->int { return 0; }()); // expected-error{{lambda expression in an unevaluated operand}}
19 const std::type_info
&ti1
= typeid([&]() -> P
& { return p
; }());
20 const std::type_info
&ti2
= typeid([&]() -> int { return i
; }()); // expected-error{{lambda expression in an unevaluated operand}}
26 T
* x
= 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} \
27 // expected-error{{cannot initialize a variable of type 'double *' with an rvalue of type 'int'}}
32 void odr_used(P
&p
, Boom
<int> boom_int
, Boom
<float> boom_float
,
33 Boom
<double> boom_double
) {
34 const std::type_info
&ti1
35 = typeid([=,&p
]() -> P
& { boom_int
.tickle(); return p
; }()); // expected-note{{in instantiation of member function 'Boom<int>::Boom' requested here}}
36 // This does not cause the instantiation of the Boom copy constructor,
37 // because the copy-initialization of the capture of boom_float occurs in an
38 // unevaluated operand.
39 const std::type_info
&ti2
40 = typeid([=]() -> int { boom_float
.tickle(); return 0; }()); // expected-error{{lambda expression in an unevaluated operand}}
42 auto foo
= [=]() -> int { boom_double
.tickle(); return 0; }; // expected-note{{in instantiation of member function 'Boom<double>::Boom' requested here}}