Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / Parser / cxx2a-template-lambdas.cpp
blob98c74a247b535fac17b6d5313eefb1dcacdc3916
1 // RUN: %clang_cc1 -std=c++23 %s -verify
2 // RUN: %clang_cc1 -std=c++20 %s -verify
4 auto L0 = []<> { }; //expected-error {{cannot be empty}}
6 auto L1 = []<typename T1, typename T2> { };
7 auto L2 = []<typename T1, typename T2>(T1 arg1, T2 arg2) -> T1 { };
8 auto L3 = []<typename T>(auto arg) { T t; };
9 auto L4 = []<int I>() { };
11 // http://llvm.org/PR49736
12 auto L5 = []<auto>(){};
13 auto L6 = []<auto>{};
14 auto L7 = []<auto>() noexcept {};
15 auto L8 = []<auto> noexcept {};
16 #if __cplusplus <= 202002L
17 // expected-warning@-2 {{lambda without a parameter clause is a C++23 extension}}
18 #endif
19 auto L9 = []<auto> requires true {};
20 auto L10 = []<auto> requires true(){};
21 auto L11 = []<auto> requires true() noexcept {};
22 auto L12 = []<auto> requires true noexcept {};
23 #if __cplusplus <= 202002L
24 // expected-warning@-2 {{is a C++23 extension}}
25 #endif
26 auto L13 = []<auto>() noexcept requires true {};
27 auto L14 = []<auto> requires true() noexcept requires true {};
29 auto XL0 = []<auto> noexcept requires true {}; // expected-error {{expected body of lambda expression}}
30 auto XL1 = []<auto> requires true noexcept requires true {}; // expected-error {{expected body}}
31 #if __cplusplus <= 202002L
32 // expected-warning@-3 {{is a C++23 extension}}
33 // expected-warning@-3 {{is a C++23 extension}}
34 #endif
36 namespace GH64962 {
37 void f() {
38 [] <typename T>(T i) -> int[] // expected-error {{function cannot return array type 'int[]'}}
39 // extension-warning {{explicit template parameter list for lambdas is a C++20 extension}}
40 { return 3; } (v); // expected-error {{use of undeclared identifier 'v'}}