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

    <tr>
        <th>Summary</th>
        <td>
            More specialized template is not selected in C++20 mode
        </td>
    </tr>

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

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

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

<pre>
    In the following program
```
template <class T, T, T>
struct A { 
    static const int i = 1;
};

template <class T, T n>
struct A<T, n, n> { 
    static const int i = 2;
};

int j;
static_assert( A<int&, j, j>::i == 2, "" );
```
GCC selects more specialized (second) `A<T, n, n>` and the check succeeds, but Clang selects the first general `A<class T, T, T>` and `static_assert` fails in C++20 mode. Surprisingly it works fine in C++14 mode. Online demo: https://godbolt.org/z/P7sGcPYKE
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMk0-PpDYQxT9NcSlty5T5Mxw4dNPNKoqirJRccoqMqaY9a-yWbTLa_fQRdO9MZiYarYQKcBXvZ94DFaOZHHML5QHKY6aWdPGh7XkM2eDHb-0vDtOF8eyt9U_GTXgNfgpqBnEEsYdK3I_tNvF8tSoxguy0VTHin0DdjyJPt6mYwqIT7hHqA96WEBFjUslo1N7FhMYlNAjyiDnIwx1WH1-uP-ShewcD2W09dyvy9HN0-oC-Tj0-r90E_lYxckhADxvSuARUrcjHW5EnkHuQ-039BqAOgQiIEKh5Qbx29nPXYWTLOkWcfWCMV9ZGWfOdRwR6iKy9G4EahEq8f1moBCo3blHqC-uvGBetmce4TgxLws4qNz0jtshNiAkndhyU_SH7v6nexaESr02oBJ6VsRGNww7oAHQggbMfeYd_LOEaTDRust_QJHzy4WvEs3H8n-m8uE__7uzaGXn2IPd4SekaVyOpB-onPw7epp0PE1D_Haj_UsfP-stfv56ysZVjIxuVcZvXIhdS5rXMLm3RNDovqVB1UalalMW5bOhcVKXKlW5GmZmWBMk8p4rynEq5a7Qc6rMUD01Z64oHKATPytidtf_MKzszMS7c1rKoRGbVwDZufxWR4yfcmmvO5TEL7frMp2GZIhTCmpjii0oyyXL729uMnz91E9H5dE-Kx_feZkuw7RuHTLosw077GahfSffTp2vwj6wTUL_tLwL12_7_DQAA__-iXjVP">