[clang] [Clang] Fix assertion failure in getASTRecordLayout for invalid declarations (PR #208153)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 23:13:35 PDT 2026


================
@@ -189,6 +189,10 @@ void EmptySubobjectMap::ComputeEmptySubobjectSizes() {
     const CXXRecordDecl *BaseDecl = Base.getType()->getAsCXXRecordDecl();
     assert(BaseDecl != Class && "Class cannot inherit from itself.");
 
+    // Skip invalid base declarations to avoid assert in getASTRecordLayout
+    if (BaseDecl->isInvalidDecl())
----------------
vgvassilev wrote:

I think this should go even higher up. ComputeEmptySubobjectSizes And friends should not be called on invalid declarations. 

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


More information about the cfe-commits mailing list