[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CXX / expr / expr.prim / expr.prim.lambda / p7.cpp
blob73714f1a947a10afe305657a4a4904c5588e707c
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);
17 };
19 (void)[=] ()->void {
20 float &fr1 = check_const_int(i);
21 float &fr2 = check_const_int(ic);
22 };
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);
39 (void)[&] ()->void {
40 int &ir = check_const_int(i);
41 float &fr = check_const_int(ic);
46 struct S1 {
47 int x, y;
48 S1 &operator=(int*);
49 int operator()(int);
50 void f() {
51 [&]()->int {
52 S1 &s1 = operator=(&this->x);
53 return operator()(this->x + y);
54 }();