<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/116286>116286</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang crash with -Wunsafe-buffer-usage on assertion failure: const ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const RecordDecl *) const: Assertion `D && "Cannot get layout of forward declarations!"' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ZequanWu
      </td>
    </tr>
</table>

<pre>
    Trunk clang crashes with `-Wunsafe-buffer-usage`: https://godbolt.org/z/Pjj413W68 and https://godbolt.org/z/j4hnY3eEz.

#91991 (reverted) introduced the same crash with `-Wunsafe-buffer-usage`: https://godbolt.org/z/vcv8d6sYr, which is likely due to the same underlying issue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyskj9v4zgQxT_NqCFsiENJlgoVOvtUXXG4BAhyHSWOJDo0meUfZ51Pv5AVbIBggW22IcEBZ97j71GGoGdL1EL5F5SnTKa4ON_-T9-StE8pG5y6tY8-2Rc2GmlnNnoZFgrsTceFQZXvnpINcqLdkKaJ_C4FORNUOYiOLTG-BhAdYA_Yz04NzsS98zNg_w7Y_3s-F1w8VTWTVv329rlY7LOgv9_3kJ8g7z5WFA1vGs4Aa09X8pEUYMO0jd6pNJJicSEW5IU273_E-XW81qoKzx7wyN4WPS5MB2b0C5kbU4lYdJ-yySry5qbtzHQIifaZaoVqRCMzavlB8Aq5yMtsaUvZSCmaehjKkjcCh8PhgIWsKiFLrKs80y3mWHDOC-RlmZf7iQ7UNJNCHAoqiKDI6SK12RtzvayGs7tky3mFdZUZOZAJ97AR74EC4pq7b9eG3ZDmAEVudIjhc0TU0VB7_Mx_Y_hLgMxZJkMgH7WzbJLaJE8r0tHZEFn38Pgfjc6rf-TNpcgAq82G6EB03cPj0dlI3-N2nil-aQCst0Fb8USjYYDdmvi9vip1P-Whyk-rBGDFAPEorXWRzRSZ2eTdxCbn36RXTNFopJdrXwDkKxc83B9Aap8lb9ovn0LHJQ370V0A-xXVx7Z79e5MYwTs7-gDYP9B_9rijwAAAP__sy8cJg">