Debian Codegraph @

clang/test/SemaCXX/cxx23-static-callop-lambda-expression.cpp

raw
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 {
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}}
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 {
23 auto lstatic = []() static { return 3; };
24 constexpr int (*f2)(void) = lstatic;
25 static_assert(lstatic() == f2());
26 }
27
28 namespace ns3 {
29 void main() {
30 static int x = 10;
31 auto L = []() static { return x; };
32 }
33 }