1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
3 // Check that analysis-based warnings work in lambda bodies.
4 void analysis_based_warnings() {
5 (void)[]() -> int { }; // expected-warning{{non-void lambda does not return a value}}
8 // Check that we get the right types of captured variables (the
9 // semantic-analysis part of p7).
10 int &check_const_int(int&);
11 float &check_const_int(const int&);
13 void test_capture_constness(int i
, const int ic
) {
14 (void)[i
,ic
] ()->void {
15 float &fr1
= check_const_int(i
);
16 float &fr2
= check_const_int(ic
);
20 float &fr1
= check_const_int(i
);
21 float &fr2
= check_const_int(ic
);
24 (void)[i
,ic
] () mutable ->void {
25 int &ir
= check_const_int(i
);
26 float &fr
= check_const_int(ic
);
29 (void)[=] () mutable ->void {
30 int &ir
= check_const_int(i
);
31 float &fr
= check_const_int(ic
);
34 (void)[&i
,&ic
] ()->void {
35 int &ir
= check_const_int(i
);
36 float &fr
= check_const_int(ic
);
40 int &ir
= check_const_int(i
);
41 float &fr
= check_const_int(ic
);
52 S1
&s1
= operator=(&this->x
);
53 return operator()(this->x
+ y
);