[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CXX / expr / expr.prim / expr.prim.lambda / p3.cpp
blobdb40bd5d1420ef382091dd3dd2926386d2c4f09c
1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
2 // RUN: %clang_cc1 -fsyntax-only -std=c++14 %s -verify
3 // RUN: %clang_cc1 -fsyntax-only -std=c++17 %s -verify
5 void test_nonaggregate(int i) {
6 auto lambda = [i]() -> void {}; // expected-note 2{{candidate constructor}}
7 decltype(lambda) foo = { 1 }; // expected-error{{no matching constructor}}
8 static_assert(__is_literal(decltype(lambda)) == (__cplusplus >= 201703L), "");
10 auto lambda2 = []{}; // expected-note 2{{candidate constructor}}
11 decltype(lambda2) bar = {}; // expected-error{{no matching constructor}}
12 static_assert(__is_literal(decltype(lambda2)) == (__cplusplus >= 201703L), "");
15 constexpr auto literal = []{};
16 #if __cplusplus < 201703L
17 // expected-error@-2 {{constexpr variable cannot have non-literal type}}
18 // expected-note@-3 {{lambda closure types are non-literal types before C++17}}
19 #endif