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

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 19 00:13:06 PDT 2022


cor3ntin added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:1904-1906
+        if (!SemaRef.LangOpts.CPlusPlus2b &&
+            CheckLiteralType(SemaRef, Kind, VD->getLocation(), VD->getType(),
                              diag::err_constexpr_local_var_non_literal_type,
----------------
hubert.reinterpretcast wrote:
> This seems to unconditionally error in pre-C++2b modes. For consistency, this should be a `-Wc++2b-extensions` warning.
We agreed not have this an extension in earlier modes because a valid c++20 program can sfinea on that. Is it not a direction you agree with anymore>


================
Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3-2b.cpp:38
+  if (!b)
+    NonLiteral n;
+}
----------------
hubert.reinterpretcast wrote:
> For consistency, this should warn (under `-Wpre-c++2b-compat`).
I though we decided *not* to do that


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