brintos

brintos / llvm-project-archived public Read only

0
0
Text · 801 B · 84fac9e Raw
34 lines · cpp
1// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s2// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter3 4namespace ns1 {5  auto lstatic = []() static { return 3; };6  int (*f2)(void) = lstatic;7 8}9 10namespace 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 22namespace ns2 {23  auto lstatic = []() static { return 3; };24  constexpr int (*f2)(void) = lstatic;25  static_assert(lstatic() == f2());26}27 28namespace ns3 {29  void main() {30    static int x = 10;31    auto L = []() static { return x; };32  }33}34