[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Parser / cxx1z-constexpr-lambdas.cpp
blob0c2f81d318a143d16a0b26c49b4444f6b56dd5d3
1 // RUN: %clang_cc1 -std=c++2b %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}}
10 #endif
11 #if __cplusplus <= 202002L
12 // expected-warning@-5 {{lambda without a parameter clause is a C++2b extension}}
13 #endif
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
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}}
30 { };
32 #else
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}}
36 #endif