<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/154840>154840</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang][modules] RecordLayoutBuilder.cpp crash: Cannot get layout of forward declarations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:modules,
crash-on-valid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rupprecht
</td>
</tr>
</table>
<pre>
This is a failure that bisects to #147835 , but I don't have a repro yet. Working on that now.
```
assertion failed at clang/lib/AST/RecordLayoutBuilder.cpp:3380 in const ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const RecordDecl *) const: D && "Cannot get layout of forward declarations!"
*** Check failure stack trace: ***
@ 0x557b3889784f clang::ASTContext::getASTRecordLayout()
@ 0x557b3823cd68 clang::ASTContext::getTypeInfoImpl()
@ 0x557b3823e25c clang::ASTContext::getTypeInfo()
@ 0x557b3823d855 clang::ASTContext::getPreferredTypeAlign()
@ 0x557b3823bf01 clang::ASTContext::getDeclAlign()
@ 0x557b366c6a06 clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca()
@ 0x557b366c165c clang::CodeGen::CodeGenFunction::EmitVarDecl()
@ 0x557b366c1120 clang::CodeGen::CodeGenFunction::EmitDecl()
@ 0x557b36760580 clang::CodeGen::CodeGenFunction::EmitDeclStmt()
@ 0x557b36754d50 clang::CodeGen::CodeGenFunction::EmitSimpleStmt()
@ 0x557b3675403e clang::CodeGen::CodeGenFunction::EmitStmt()
@ 0x557b36761891 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope()
@ 0x557b368c47d5 clang::CodeGen::CodeGenFunction::GenerateCode()
@ 0x557b368ef9f6 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition()
@ 0x557b368e6bc8 clang::CodeGen::CodeGenModule::EmitGlobalDefinition()
@ 0x557b368d7786 clang::CodeGen::CodeGenModule::EmitDeferred()
@ 0x557b368d77a2 clang::CodeGen::CodeGenModule::EmitDeferred()
...
@ 0x557b368d77a2 clang::CodeGen::CodeGenModule::EmitDeferred()
@ 0x557b368d77a2 clang::CodeGen::CodeGenModule::EmitDeferred()
@ 0x557b368d41ae clang::CodeGen::CodeGenModule::Release()
@ 0x557b36a1e14e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit()
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy81l2PozYXB_BP49wcTWQM5uWCCzZ5Ms9IrVRt0t1rYw7BHWMj28zufPvKybxttxlmpmolJIRDfn98YuIjvFdHg1gT_onw7UrMYbCudvM0OZRDWLW2u68Pg_KgPAjohdKzQwiDCNAqjzJ4CBYIS5OsKFMOhG2gnQPcQGcNYUWAQdwhCHA4OQv3GNbw1bpbZY5gzRky9tua0CYeOX04aCO8RxeUNadU7EAEkFqYI2E7rVrCds3-QNjuM0rrul_EvZ3Dp1npDt1aThNJmzQtKSgD0hofoNkfXt4KhOVnLm1I2jT7w8aagN_D-fqI4S9fIKw8Q-fBLUoNhDWEVecAkjawjSphORDGNsIYG-CIAfQ50fbQW_dNuA46lFo4EafnCUsIY3H27OGAzYDy9qnaPgh5C8EJiTHk6TZCGwAAktF4Avqd86JNy7IqyqyH906OsOoCyFLZ5eUCeLif8Mb09mac9IKGjMs3agtSV3K-IP3msEfnsItko9XRLJhtT5MFM_72i1Sey1zQ_CW1sR1eo_nhYjcbGZfBefB_owrNHOwX4RqtrRQ_JTzrSc4lvJ__Ilx8_tfghNEPwK-qRU55-VF1H8afV-iTzLOOf0Teq3HSuGTTFD9iv6rmSVkl70c3dpzsbLqIf1VhsHPYSzvhxaBSZkXH3_n412jQiYDxw8sy9lW_uLZ_td2s8XkC19q2Qj_GbbFXRp2CL8fkrSwXJ_D3OW_xu6Io83f724e_lFddwf65u16v_0X9v3OzRCy_RS_dz6hR-MvrTySYZAhAWCmMNfejnT0YMaKf4i7Jqh_kuJ6tO-1Mp-H_C9N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