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

    <tr>
        <th>Summary</th>
        <td>
            Clang chooses the incorrect overload when explicit and implicit member functions are involved
        </td>
    </tr>

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

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

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

<pre>
    Clang incorrectly chooses the explicit object member function for the call `B{}.f()` in the below program: [Demo](https://godbolt.org/z/oY5b95944)

```
struct A {
    int f() {
        std::cout << "implicit\n";
         return 1; } 
 A(const A&)
    {
        std::cout << "copy ctor\n";
    }
 A()= default;
};

struct B : A {
    using A::f;
    int f(this A) { 
        std::cout << "explicit\n";
        return 2; }
};

int main() {
    return B{}.f();
}
```
Clang incorrectly prints:
```
copy ctor
explicit
```
While gcc prints:

```
implicit
```
This has been discussed [here](https://stackoverflow.com/questions/78779816/overload-resolution-between-ordinary-and-explicit-object-member-functions)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMuOqzgQ_ZpiUyICE14LFkmjfMFIo1kauxI8Y-yMbdLT8_VXJiTdN5crdRQlgA_1OHXqcO_VxRB1UB6h7BM-h9G6znHDubH2mgxWfnRvmpsLKiOscySC_kAxWuvJYxgJ6b-rVkIFtMPfJAJONA3k8DwbEZQ1eLZuwQmuNUKVHaE-Qt3vzsAaYC1UGSqzIAbS9h2vzl4cn6A4IJTHniYLZQ-sGUO4eigOwE7AThcrB6vDzroLsNP_wE72r3Joy3a_j0GzHrLD-ltl63e59cHNIuABYxnLE0REZQKuBf18ED8-yJi3OAg7B4TiDYo3BMbUdO8cyjcDjEHx8h46CrMzmENxRKh7XI8PwBphjQ_xqnqWG9_4dm5hrx8ognVbyaHuv6SKCYoeJZ35rMMTGEHP66_UHDFy_0LQ7JW54OFey_mnbA_uwqh8TLgwiN9r4yGe31G4MshWBn9XeSxh4spsTXAN8Sq7rzRs6eRX0V-dMmFR4Bb-cyDL7bOxLeyfo9KEFyF-ibmFfsps6_CPSPrIPQ5EBqXyYvaeZFydkRxtrY4PXPxjb-TO2r7vhJ2Anf6dycdt9cBOdVPXbZNXcadu5LTlMnXkrZ4jIh0ovBOZ1DqpDHcfKTcyfbSb3k0gvZtA-jABD6xNZFfItmh5Ql1es7yqGtY2ydhxLkTbNEJU7VAUkslsaGSe1U25r9p9lSeqYxnbZzVjeZ3nRb0byizLW8GEEKJpiWCf0cSV3ml9m6IlJMr7mbq2bTOWaD6Q9ovFMSbiWKPSyj5xXcSnw3zxsM-08sF_RggqaFqt76vdPRWBD3LwfSTzaYPcSHyM7NUMPXIXQ9ysvpFMZqe7F1tTYZyHdSixlvUvvTobiQV2WlqLc7p3d-vYjwAAAP__j3Crig">