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

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 22 06:20:38 PDT 2022


erichkeane added a comment.

1 request for a test, and 1 hope that @aaron.ballman will help bikeshed (or just say its fine!), but otherwise LGTM.



================
Comment at: clang/include/clang/Basic/DiagnosticASTKinds.td:69
+def note_constexpr_static_local : Note<
+  "control flows through the declaration of a %select{static|thread_local}0 variable">;
 def note_constexpr_subobject_declared_here : Note<
----------------
Hmm... this feels a little awkward to me.  Though, I usually have Aaron do the bikeshedding, so if he didn't come up with better I guess we can let it go.


================
Comment at: clang/lib/AST/ExprConstant.cpp:5010
+  // through a declaration of a variable with static or thread storage duration.
+  if (VD->isLocalVarDecl() && VD->isStaticLocal()) {
+    Info.CCEDiag(VD->getLocation(), diag::note_constexpr_static_local)
----------------
Can we make sure we have tests for the 'other' two types of TSCSpec?  I'm not too worried about C11 thread local (it does, after all, require static), but the GNU __thread does not.


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