[clang] [Clang] prevent assertion failure by avoiding casts on type declarations that require complete types (PR #101426)
Mital Ashok via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 1 01:37:50 PDT 2024
MitalAshok wrote:
I think the issue is here somewhere:
https://github.com/llvm/llvm-project/blob/7088a5ed880f29129ec844c66068e8cb61ca98bf/clang/lib/Sema/SemaDecl.cpp#L8753-L8764
An incomplete struct passes `CheckC23ConstexprVarType` (which it should, incomplete types should fail later) so it goes on to the next check. We should only check `RequireLiteralType` in C++. The cast isn't failing because it's expecting a complete type, it's failing because it's expecting a `CXXRecordDecl` when we only have a C `RecordDecl`.
https://github.com/llvm/llvm-project/pull/101426
More information about the cfe-commits
mailing list