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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 28 09:00:03 PST 2023


================
@@ -8605,6 +8620,28 @@ static bool checkForConflictWithNonVisibleExternC(Sema &S, const T *ND,
   return false;
 }
 
+static bool CheckC23ConstexprVarTypeQualifiers(Sema &SemaRef,
+                                               SourceLocation VarLoc,
+                                               QualType T) {
+  if (const auto *A = SemaRef.Context.getAsArrayType(T)) {
+    T = A->getElementType();
+  }
----------------
AaronBallman wrote:

```suggestion
  // Arrays are qualified by their element type, so get the base type (this works on non-arrays as well).
  T = SemaRef.Context.getBaseElementType(T);
```

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


More information about the cfe-commits mailing list