blob: 4cf3d12211676ffa1bbe09853580279afa347494 [file] [log] [blame]
Richard Smithcbaaa292017-08-13 22:26:53 +00001// RUN: %clang_cc1 -std=c++17 %s -verify
Faisal Valia734ab92016-03-26 16:11:37 +00002// RUN: %clang_cc1 -std=c++14 %s -verify
3// RUN: %clang_cc1 -std=c++11 %s -verify
4
5
6auto XL0 = [] constexpr { }; //expected-error{{requires '()'}} expected-error{{expected body}}
7auto XL1 = [] () mutable
8 mutable //expected-error{{cannot appear multiple times}}
9 mutable { }; //expected-error{{cannot appear multiple times}}
10
11#if __cplusplus > 201402L
12auto XL2 = [] () constexpr mutable constexpr { }; //expected-error{{cannot appear multiple times}}
13auto L = []() mutable constexpr { };
14auto L2 = []() constexpr { };
15auto L4 = []() constexpr mutable { };
16auto XL16 = [] () constexpr
17 mutable
18 constexpr //expected-error{{cannot appear multiple times}}
19 mutable //expected-error{{cannot appear multiple times}}
20 mutable //expected-error{{cannot appear multiple times}}
21 constexpr //expected-error{{cannot appear multiple times}}
22 constexpr //expected-error{{cannot appear multiple times}}
23 { };
24
25#else
Richard Smithcbaaa292017-08-13 22:26:53 +000026auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++17 extension}}
27auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++17 extension}}
28auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++17 extension}}
Faisal Valia734ab92016-03-26 16:11:37 +000029#endif
30
31