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

    <tr>
        <th>Summary</th>
        <td>
            incorrect overload resolution with deducing this
        </td>
    </tr>

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

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

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

<pre>
    Hey,
@Waffl3x mentioned a possible bug in clang earlier and asked me to report it. 

```cpp
template<typename T>
concept AlwaysTrue = true;

struct S {
  int f(AlwaysTrue auto) { return 1; }; // f1
  int f(this S&&, auto) { return 2; };  // f2
};

int main() {
  return S{}.f(0);
}
```
https://clang.godbolt.org/z/x516PWsvd

According to [[basic.scope.scope]/3](https://eel.is/c++draft/basic.scope.scope#3) `f1` and `f2` should have corresponding signatures. Considering [[over.match.funcs.general]/5](https://eel.is/c++draft/over.match.funcs.general#5.sentence-3) I believe `f1` should be called here since it is more constrained. Clang however calls `f2`.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlM2O5CYQx58GX0pj2eDPgw_T3Wklt0gz0p4xlG0SDBbgnu08fQTu7PRuksNKCETh-tW_qDLcezUbxIHUJ1JfMr6Hxbrh3YsFs9HK-_Ar3gk9k-JCildSFV_4NGn2FVY0QVmDEjhs1ns1aoRxn0EZEJqbGZA7rdABNxK4_xMlrAjBgsPNugAq5PCgHnNTHENs22EJuG6aByTsHO4bGr4ivBP2y3EqrBG4BXjVH_zu392OQNgFgtuRsNMz2Qe3iwBvQNqHHUCZABOh3ZM334MltI9fgcOwOwMlYScg7SUt9EroFabyR0RYlIc3Qps0zv_FoU-cbyD60JjMz3ojeOXKENo9OP-EfODeoqm95DF6QWj_6d9efrjMY7uEsHnCXo_QqTz5bOVodcitmwm9_kXo9WtdNr9_8Tf5LOZVCOukMnMsXWqS08i9ErkXdsNjJvWF0CtLS_d9LESdKx-DEnoi9CQdnwKh138zKGMp26aYStIUqW3ihsaNX-yuJSz8hiCsc-g3a5Kq2L487A59DmdrvJLoov2Qam_o8pUHseTTboTPZzTouD4U1z-j-H9RlNW5RxPQCHxJOfwGI2qFN_zM5pHAiCC41ihhQYfglREIKoDysFoXczM-OK4MyhzO6Tda7Afe0CU__-1G8qM6mRyY7FnPMxzKtijbnnVNly0Dl31T9bIYO5SsKvuJToWcul7wbhJ1KTM10IKykhZ12bCyKHNW8qmX1dSNTV22jSBVgStXOtf6tsYuyZT3Ow5tVfVVpvmI2qdXg1KDH5AOCaXxEXFD9HkZ99mTqtDKB_9JCSpoHJRJZRQB4r1qyyU49Fbv8VGBDxUWkCh3kRpvUT7bnR6-L9SswrKPubArodeIfywvm7N_oIg1S6JiLZPovwMAAP__5vGAAA">