[mlir] [clang] [compiler-rt] [llvm] [lldb] [libcxxabi] [libcxx] [clang-tools-extra] [flang] [lld] [libunwind] [libc] [openmp] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 30 03:10:51 PST 2023
================
@@ -2485,12 +2485,12 @@ bool VarDecl::mightBeUsableInConstantExpressions(const ASTContext &C) const {
// In C++, const, non-volatile variables of integral or enumeration types
// can be used in constant expressions.
- if (getType()->isIntegralOrEnumerationType())
+ if (getType()->isIntegralOrEnumerationType() && !Lang.C23)
return true;
// Additionally, in C++11, non-volatile constexpr variables can be used in
// constant expressions.
- return Lang.CPlusPlus11 && isConstexpr();
+ return (Lang.CPlusPlus11 || Lang.C23) && isConstexpr();
----------------
Fznamznon wrote:
Ok, updated.
https://github.com/llvm/llvm-project/pull/73099
More information about the cfe-commits
mailing list