[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 28 21:09:14 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();
----------------
cor3ntin wrote:

Can we update the comments? Maybe with standardese references too

https://github.com/llvm/llvm-project/pull/73099


More information about the cfe-commits mailing list