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
10 // semantic-analysis part of p7).
11 int &check_const_int(int&);
12 float &check_const_int(const int&);
13 
14 void test_capture_constness(int i, const int ic) {
15   [i,ic] ()->void { // expected-error{{lambda expressions are not supported yet}}
16     float &fr1 = check_const_int(i);
17     float &fr2 = check_const_int(ic);
18   };
19 
20   [=] ()->void { // expected-error{{lambda expressions are not supported yet}}
21     float &fr1 = check_const_int(i);
22     float &fr2 = check_const_int(ic);
23   };
24 
25   [i,ic] () mutable ->void { // expected-error{{lambda expressions are not supported yet}}
26     int &ir = check_const_int(i);
27     float &fr = check_const_int(ic);
28   };
29 
30   [=] () mutable ->void { // expected-error{{lambda expressions are not supported yet}}
31     int &ir = check_const_int(i);
32     float &fr = check_const_int(ic);
33   };
34 
35   [&i,&ic] ()->void { // expected-error{{lambda expressions are not supported yet}}
36     int &ir = check_const_int(i);
37     float &fr = check_const_int(ic);
38   };
39 
40   [&] ()->void { // expected-error{{lambda expressions are not supported yet}}
41     int &ir = check_const_int(i);
42     float &fr = check_const_int(ic);
43   };
44 }
45 
46 
47