[PATCH] D111400: [Clang] Implement P2242R3

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 07:37:04 PDT 2022


cor3ntin added inline comments.


================
Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:60-61
+
+constexpr int ke = k_evaluated(1); //expected-error {{constexpr variable 'ke' must be initialized by a constant expression}} \
+                                   //expected-note {{in call}}
+
----------------
aaron.ballman wrote:
> This error seems suspect to me. If we made flowing through a thread_local into an extension (line 54), then this code should be accepted. However, I think we're getting the error because the constant expression evaluator produces the note on line 55 and that usually will cause the evaluator to claim it wasn't a constant expression.
We can not evaluate at compile time a thread_local or static, even if we allow them to appear in a `constexpr` function. So this is the behavior I'd expect


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