[PATCH] D133659: [Clang] P1169R4: static operator()

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 12 17:38:18 PDT 2022


shafik added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:15934
+  //   or a reference to an enumeration.
+  // Note: Before C++23, a member function also has to not be static.
   if (CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(FnDecl)) {
----------------



================
Comment at: clang/test/Parser/cxx2b-lambdas.cpp:42
+
+auto XL7 = []() static static {}; // expected-error {{cannot appear multiple times}}
+auto XL8 = []() static mutable {}; // expected-error {{cannot be both mutable and static}}
----------------
also combined w/ `constexpr` and `consteval`


================
Comment at: clang/test/Parser/cxx2b-lambdas.cpp:52
+  auto SC2 = [&x]() static {}; // expected-error {{a static lambda cannot have any captures}} // expected-note {{captures declared here}}
+  auto SC3 = [=]() static {}; // expected-error {{a static lambda cannot have any captures}} // expected-note {{captures declared here}}
+}
----------------
Why not throw in capture by copy/move as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133659/new/

https://reviews.llvm.org/D133659



More information about the cfe-commits mailing list