Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / expr / expr.prim / expr.prim.lambda / p2-generic-lambda-1y.cpp
blob3112bc726818edcc4a3f9a9db7af12fdc26362f6
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y
3 // 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}}
9 namespace std {
10 class type_info;
13 struct P {
14 virtual ~P();
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 // expected-note 2 {{capture 'i' by}}\
26 // expected-note 2 {{default capture by}}