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

    <tr>
        <th>Summary</th>
        <td>
            Incorrect constraint check with template friend function
        </td>
    </tr>

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

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

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

<pre>
    See https://godbolt.org/z/rTcabGbbh. This compiles with GCC 13.2, but with clang 18.1.0.

I’ve tried to reduce this to the smallest program that exhibits the bug, and AFAICT, it relates to a template friend function that has the same template arguments as its enclosing class, but the order of the template arguments are reversed. When instantiating the template function, the compiler seems to apply the wrong constraint checks (C++ concepts) on the template arguments.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0Uk1vpDgQ_TXmUgoCQ3fDgUOns0Q5b6Q9-6MavGNs5CqSyfz6kelE0cxkLqDiud6HeYrITQFxEId7cXgo1MZzTANHaxOiLXS0b8O_iDAzrySas5CjkOMUrY6ey5gmIccfQo7p2Sj9qPVcwvPsCExcVueR4NXxDI-XC9RNKYW8gN749tF4FSaou7Iuq1JUD6I6355P4h8pukr0_QsCJ4cWOEJCuxkEzuwcgWcEWpT3SAxrilNSC_CsGPD77LRj2o_obcqiKlg4j-eny3OeHENCrxh3JgWMy5pHuCaHwcJ1C4ZdDDe-Wd2oSC34eVSlaVswMIEiyGoYjI_kwpSDEX1EzZsxWUwQr_vwFUNCSPiCidCW8N-MAVwgVoGd4sz4y96Hu6yQgferTkCIyy3Ruvq3HXtNMRuKgTgpFxjMjOYbgZDdRch7Ie8zaHBlErKHPfJXFt__T2GHxvZNrwoc6lPdyuZ4OHXFPLT6WtXKmK7C1mBl68NRYdso29uu05Ut3CAr2VatPNXHtm-68tjJujtoezpWp7ZttGgrXJTzpfcvSy5W4Yg2HPqqafvCK42e9pZKGfAVdlBImUubhrxzp7eJRFt5R0yfLOzY4_AUTEwJDf9xF7cu_q0BxZb88Fv3Hc-bLk1chByzzPvrbk3xfzQs5LibIyHH3fzPAAAA__-foiTw">