[PATCH] D111400: [Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 20 17:36:44 PDT 2022


hubert.reinterpretcast added inline comments.


================
Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:163
+
+// Test whether lambda are correctly treated as implicitely constexpr under the relaxed c++23 rules.
+int test_lambdas_implicitly_constexpr() {
----------------
Fix typo and expand comment.


================
Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:165-169
+  auto a = [] {
+    static const int m = 32;
+    return m;
+  };
+
----------------
Remove this lambda. It is not callable in any constant expression even under C++2b mode.


================
Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:194-195
+  c(0);
+  constexpr auto c_ok = c(0); // cxx2a-error {{must be initialized by a constant expression}} \
+                               // cxx2a-note {{non-constexpr function}}
+
----------------
Minor nit: Align comments.


================
Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:207-209
+  constexpr auto non_literal_ko = non_literal(true); // expected-error {{constexpr variable 'non_literal_ko' must be initialized by a constant expression}} \
+                                                      // cxx2a-note {{non-constexpr function}} \
+                                                      // cxx2b-note {{in call}}
----------------
Minor nit: Align comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400



More information about the cfe-commits mailing list