xref: /llvm-project/clang/test/SemaCXX/cxx23-static-callop-lambda-expression.cpp (revision f34a5205aa481a6d9a15054bcc5f7b9875906a17)
1 // RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter
3 
4 namespace ns1 {
__anone46ebcbe0102() 5   auto lstatic = []() static { return 3; };
6   int (*f2)(void) = lstatic;
7 
8 }
9 
10 namespace ns1_1 {
11 
12   auto lstatic = []() static consteval  //expected-error{{cannot take address of consteval call}} \
13                                           expected-note {{declared here}}
__anone46ebcbe0202() 14   { return 3; };
15 
16   // FIXME: the above error should indicate that it was triggered below.
17   int (*f2)(void) = lstatic;
18 
19 }
20 
21 
22 namespace ns2 {
__anone46ebcbe0302() 23   auto lstatic = []() static { return 3; };
24   constexpr int (*f2)(void) = lstatic;
25   static_assert(lstatic() == f2());
26 }
27 
28 namespace ns3 {
main()29   void main() {
30     static int x = 10;
31     auto L = []() static { return x; };
32   }
33 }
34