[clang] [clang][Sema] Recheck array size once the element type is complete (PR #219817)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 06:25:26 PDT 2026
================
@@ -9688,6 +9688,28 @@ static void assignInheritanceModel(Sema &S, CXXRecordDecl *RD) {
}
}
+/// Return the (possibly nested) constant array type in \p T whose size cannot
+/// be represented, if any. BuildArrayType can only check the element count if
+/// the element type is still incomplete when the array type is formed.
+static const ConstantArrayType *findArrayTypeTooLarge(const ASTContext &Context,
+ QualType T) {
+ const auto *CAT = dyn_cast<ConstantArrayType>(T.getCanonicalType());
----------------
erichkeane wrote:
You can't do dyn_cast here. you have to use `getAsConstantArrayType`.
https://github.com/llvm/llvm-project/pull/219817
More information about the cfe-commits
mailing list