brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 3112bc7 Raw
28 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y2 3// prvalue4void 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'}}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}}27}28