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

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 22 10:36:39 PDT 2022


hubert.reinterpretcast added a comment.

Confirming LGTM with minor comments.

In D111400#3399929 <https://reviews.llvm.org/D111400#3399929>, @cor3ntin wrote:

> - We may still miss a compatibility warning for non-literal in c++23 mode?

My understanding is that Aaron and I both want the warning added (but are okay with having this patch landed).



================
Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:23
+  static _Thread_local int m = 0;     // expected-note {{control flows through the definition of a thread_local variable}} \
+                                        // cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
+  return m;
----------------
Formatting nit.


================
Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:29
+  static __thread int m = 0;            // expected-note {{control flows through the definition of a thread_local variable}} \
+                             / cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
+  return m;
----------------
Formatting nit.


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