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

    <tr>
        <th>Summary</th>
        <td>
            Clang frontend C++ crash when using declaration refers to its own class c++20 and above
        </td>
    </tr>

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

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

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

<pre>
    To quickly reproduce: https://gcc.godbolt.org/z/Y9r3sYhYc (assertion-trunk)

```cpp
#include <variant>
using namespace std;
struct test: variant <int> {
    using test::variant; // using refers to its own class, removing this line leads to correct compilation.
 void mutated_v1(variant <int> v);
};
int main() {}
```

Compiling the above code crashes clang `clang++ -x c++ -std=c++20`, crashes locally using clang-17.0 (a10019a), also on trunk with assertion (see godbolt link)

Note `--std=c++17` does not crash.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0U02TmzoQ_DXDZcoUCIzNgYM_no_v9C57eiWkMSgrJEcj2Gx-fYqPdZJNpcplBBr1dPe0JLPpHFED-zPsr4kcY-9D04YxSstykh0lrdfvzX8ev45Gvdp3DPQIXo-KoDhhH-ODoTiBuIG4dUqlndettzH1oQNx-w7i9lKHgl_6F4UgjpKZQjTe7WIY3SuIGrIrZKftv8rWn3o8ti-iME7ZURNCcZlkMNJFKP5Zd0c2rkMnB-KHVIQcNRTndY9jGFXESBxnptvRGcUsCAiHrRIRcUXaiqE4PTudcdW2VQS6U2CMHk1k9G8OlZXMIC4YaPDTgtIbRmscoSWpl2LlQyAVUfnhYaycDUi35pM3Gocxykj6_ykHcfyT6jT79CEMDtfn2riIgzQOxBFEvUg6XD95-avBl6X_SpJQtn4iVF4TqiC5J57VuA7nCcwLEGcQZ9x9Q_WxXCy-bq9iwReX53HrlbT2fTNrwdjlhzRbRp9nWV7LWYq4oLTs0TtcYoBvJvb4zMZczUS4ZWn28nNS_vWRZpq73wnlB6gy1J4YnY8rrTTRTaHropYJNXl1rPa52JeHpG_u-0rVeXUkUZeVOgqR39tjtVe6vatM5ioxjchEkVV5ntelEIe0utdS11VZUt3ei1xDmdEgjU2tnYY584lhHqmpCrEvEytbsvxxuUIzF-3asWMoM2s48s9j0URLzWVx_x68i-Q0XjbTFxn41pPbjNWkrAxLjP6WSHyOCKXT66iTMdjm05U1sR_bVPkBxG1msz12j-C_kIogbosiBnFbRP0IAAD__3FGTqI">