1 // RUN: %clang_cc1 -std=c++23 %s -verify
2 // RUN: %clang_cc1 -std=c++20 %s -verify
3 // RUN: %clang_cc1 -std=c++17 %s -verify
4 // RUN: %clang_cc1 -std=c++14 %s -verify
5 // RUN: %clang_cc1 -std=c++11 %s -verify
7 auto XL0
= [] constexpr { return true; };
8 #if __cplusplus <= 201402L
9 // expected-warning@-2 {{is a C++17 extension}}
11 #if __cplusplus <= 202002L
12 // expected-warning@-5 {{lambda without a parameter clause is a C++23 extension}}
14 auto XL1
= []() mutable //
15 mutable // expected-error{{cannot appear multiple times}}
16 mutable {}; // expected-error{{cannot appear multiple times}}
18 #if __cplusplus > 201402L
19 auto XL2
= [] () constexpr mutable constexpr { }; //expected-error{{cannot appear multiple times}}
20 auto L
= []() mutable constexpr { };
21 auto L2
= []() constexpr { };
22 auto L4
= []() constexpr mutable { };
23 auto XL16
= [] () constexpr
25 constexpr //expected-error{{cannot appear multiple times}}
26 mutable //expected-error{{cannot appear multiple times}}
27 mutable //expected-error{{cannot appear multiple times}}
28 constexpr //expected-error{{cannot appear multiple times}}
29 constexpr //expected-error{{cannot appear multiple times}}
33 auto L
= []() mutable constexpr {return 0; }; //expected-warning{{is a C++17 extension}}
34 auto L2
= []() constexpr { return 0;};//expected-warning{{is a C++17 extension}}
35 auto L4
= []() constexpr mutable { return 0; }; //expected-warning{{is a C++17 extension}}