brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 87584ee Raw
39 lines · cpp
1// RUN: %clang_cc1 -std=c++23 %s -verify2// RUN: %clang_cc1 -std=c++20 %s -verify3// RUN: %clang_cc1 -std=c++17 %s -verify4// RUN: %clang_cc1 -std=c++14 %s -verify5// RUN: %clang_cc1 -std=c++11 %s -verify6 7auto XL0 = [] constexpr { return true; };8#if __cplusplus <= 201402L9// expected-warning@-2 {{is a C++17 extension}}10#endif11#if __cplusplus <= 202002L12// expected-warning@-5 {{lambda without a parameter clause is a C++23 extension}}13#endif14auto XL1 = []() mutable //15    mutable             // expected-error{{cannot appear multiple times}}16    mutable {};         // expected-error{{cannot appear multiple times}}17 18#if __cplusplus > 201402L19auto XL2 = [] () constexpr mutable constexpr { }; //expected-error{{cannot appear multiple times}}20auto L = []() mutable constexpr { };21auto L2 = []() constexpr { };22auto L4 = []() constexpr mutable { }; 23auto XL16 = [] () constexpr24                  mutable25                  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                  { };31 32#else33auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++17 extension}}34auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++17 extension}}35auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++17 extension}}36#endif37 38 39