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
6
7 auto XL0 = [] constexpr { return true; };
8 #if __cplusplus <= 201402L
9 // expected-warning@-2 {{is a C++17 extension}}
10 #endif
11 #if __cplusplus <= 202002L
12 // expected-warning@-5 {{lambda without a parameter clause is a C++23 extension}}
13 #endif
14 auto XL1 = []() mutable //
15 mutable // expected-error{{cannot appear multiple times}}
__anon2b446f440102() 16 mutable {}; // expected-error{{cannot appear multiple times}}
17
18 #if __cplusplus > 201402L
__anon2b446f440202() 19 auto XL2 = [] () constexpr mutable constexpr { }; //expected-error{{cannot appear multiple times}}
__anon2b446f440302() 20 auto L = []() mutable constexpr { };
__anon2b446f440402() 21 auto L2 = []() constexpr { };
__anon2b446f440502() 22 auto L4 = []() constexpr mutable { };
23 auto XL16 = [] () constexpr
24 mutable
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}}
__anon2b446f440602() 30 { };
31
32 #else
__anon2b446f440702() 33 auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++17 extension}}
__anon2b446f440802() 34 auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++17 extension}}
__anon2b446f440902() 35 auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++17 extension}}
36 #endif
37
38
39