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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 09:37:42 PST 2024


================
@@ -8569,6 +8571,37 @@ static bool checkForConflictWithNonVisibleExternC(Sema &S, const T *ND,
   return false;
 }
 
+static bool CheckC23ConstexprVarType(Sema &SemaRef, SourceLocation VarLoc,
+                                     QualType T) {
+
+  if (T->isVariableArrayType()) {
+    SemaRef.Diag(VarLoc, diag::err_c23_constexpr_invalid_type) << T;
+    return true;
+  }
+
+  // Arrays are qualified by their element type, so get the base type (this
+  // works on non-arrays as well).
+  T = SemaRef.Context.getBaseElementType(T);
+
+  // C23 6.7.1p4: An object declared with storage-class specifier constexpr or
----------------
AaronBallman wrote:

```suggestion
  // C23 6.7.1p5: An object declared with storage-class specifier constexpr or
```

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


More information about the cfe-commits mailing list