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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] cert-dcl58-cpp crashes with friend declaration
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Running the cert-dcl58-cpp check with the following code crashes clang-tidy:

`struct A
{
  friend struct B;
};

struct B;

template<typename> struct T {};

T<B> b;
`

Here's the corresponding stack trace:
[Stacktrace.txt](https://github.com/llvm/llvm-project/files/9250727/Stacktrace.txt)

The crash happens since a week or two.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVU02P2yAQ_TX2BcXCOPjj4EPd7Krn7ap3jMc2XQIWjJvm3xeTWNk2p0rWMMw8P97MQG-Ha_u2GqPMRHAGIsHhYZCa1we5LETOID_IReEcs6PV2l42rLRDADvhZ_BEamGmA6rhmhRfEnpK6G5L6tGtEskeqLqbQ8joFJiB3PNdUnQ75PTwo32GRItwXrRASIqveF3AiHNwX3bCd7Kd9cT1HtDdBusfiZJ-RnwDBwmr_K0d1jnwizXDVrRHEbqBTkh4FMq771s4RjP8jQk_JayeERe_gdhr-KbQwLXPpD2Hjda_9uWwOPsTJIbtqDT4sDaM04pVwfuHljV_1THf209msYTiPfHKSCCCXAA-iHUELza7YVNo85I3nB0rXqdDWwxN0YgUFWpog_5P4-Onpxtwn3G8A_eZDRB-cQKVNenqdPvfxSrv11gtLxvK0rntayibMkgUfc2rIxVjVecjp6UoaqhpnmrRg_ab2oQxAxcSKYIfJKeqZZQxWtMizynnZVaVfaDK836oxJFWTXKkcBZKZ5uOzLopdW2U1K-TD0mtPPpHUnivJgOxORu_WHG2rv3xBio8CI1pPLyN4v8ANy4BMQ">