1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify 2 3 // Check that analysis-based warnings work in lambda bodies. 4 void analysis_based_warnings() { 5 []() -> int { }; // expected-warning{{control reaches end of non-void function}} \ 6 // expected-error{{lambda expressions are not supported yet}} 7 } 8 9 // Check that we get the right types of captured variables (the semantic-analysis part of 10 int &check_const_int(int&); 11 float &check_const_int(const int&); 12 13 void test_capture_constness(int i, const int ic) { 14 [i,ic] ()->void { // expected-error{{lambda expressions are not supported yet}} 15 float &fr1 = check_const_int(i); 16 float &fr2 = check_const_int(ic); 17 }; 18 19 [=] ()->void { // expected-error{{lambda expressions are not supported yet}} 20 float &fr1 = check_const_int(i); 21 float &fr2 = check_const_int(ic); 22 }; 23 24 [i,ic] () mutable ->void { // expected-error{{lambda expressions are not supported yet}} 25 int &ir = check_const_int(i); 26 float &fr = check_const_int(ic); 27 }; 28 29 [=] () mutable ->void { // expected-error{{lambda expressions are not supported yet}} 30 int &ir = check_const_int(i); 31 float &fr = check_const_int(ic); 32 }; 33 34 [&i,&ic] ()->void { // expected-error{{lambda expressions are not supported yet}} 35 int &ir = check_const_int(i); 36 float &fr = check_const_int(ic); 37 }; 38 39 [&] ()->void { // expected-error{{lambda expressions are not supported yet}} 40 int &ir = check_const_int(i); 41 float &fr = check_const_int(ic); 42 }; 43 } 44 45 46