[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / Parser / cxx2b-lambdas.cpp
blob57e81eed7b9e0b1cde47c7c59fa3864dd5c19137
1 // RUN: %clang_cc1 -std=c++2b %s -verify
3 auto LL0 = [] {};
4 auto LL1 = []() {};
5 auto LL2 = []() mutable {};
6 auto LL3 = []() constexpr {};
8 auto L0 = [] constexpr {};
9 auto L1 = [] mutable {};
10 auto L2 = [] noexcept {};
11 auto L3 = [] constexpr mutable {};
12 auto L4 = [] mutable constexpr {};
13 auto L5 = [] constexpr mutable noexcept {};
14 auto L6 = [s = 1] mutable {};
15 auto L7 = [s = 1] constexpr mutable noexcept {};
16 auto L8 = [] -> bool { return true; };
17 auto L9 = []<typename T> { return true; };
18 auto L10 = []<typename T> noexcept { return true; };
19 auto L11 = []<typename T> -> bool { return true; };
20 auto L12 = [] consteval {};
21 auto L13 = []() requires true {};
22 auto L14 = []<auto> requires true() requires true {};
23 auto L15 = []<auto> requires true noexcept {};
24 auto L16 = [] [[maybe_unused]]{};
26 auto XL0 = [] mutable constexpr mutable {}; // expected-error{{cannot appear multiple times}}
27 auto XL1 = [] constexpr mutable constexpr {}; // expected-error{{cannot appear multiple times}}
28 auto XL2 = []) constexpr mutable constexpr {}; // expected-error{{expected body of lambda expression}}
29 auto XL3 = []( constexpr mutable constexpr {}; // expected-error{{invalid storage class specifier}} \
30 // expected-error{{function parameter cannot be constexpr}} \
31 // expected-error{{C++ requires}} \
32 // expected-error{{expected ')'}} \
33 // expected-note{{to match this '('}} \
34 // expected-error{{expected body}} \
35 // expected-warning{{duplicate 'constexpr'}}
37 // http://llvm.org/PR49736
38 auto XL4 = [] requires true {}; // expected-error{{expected body}}
39 auto XL5 = []<auto> requires true requires true {}; // expected-error{{expected body}}
40 auto XL6 = []<auto> requires true noexcept requires true {}; // expected-error{{expected body}}