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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Unexpected Overloading of Static and Non-Static Member Functions
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          16bit-ykiko
      </td>
    </tr>
</table>

<pre>
    According to the C++ Standard, static and non-static member functions with the same parameter types cannot be overloaded. The following code should fail to compile.

```cpp
struct X {
    void f() const;
    static void f();
};
```

It fails in clang 17, but succeeds in clang 18. And I find it is related to the declaration order. If swap the declaration order of the two functions

```cpp
struct X {
    static void f();
    void f() const;
};
```

It fails as expected, please see [Compiler Explorer](https://godbolt.org/z/h11vhjTGb).

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyck02PnDgQhn-NuZQagWmgOXDoj2U1h9097ETK1dhF4xljI7vonsmvj6DpTCuKkigSAuzyx1tP1StC0GeLWLP8wPJTJCbqna_TotW0eX_Vry5qnXqv91I6r7Q9AzmgHuHI-IHxA_xPwirhFeNHCCRISxBWgXV2sw4HHFr00E1WknY2wFVTv5wRxIAwCi8GJPRA7yMGkMJaR9AiuAt644RCFcNzj9A5Y9x11iCdQgi9m4yCTmgzi5JuGLXBmCUnluzXd5HcHjmOt5lAfpIEn4GVh9sMAMDFaQUd4zvGK5DOBmLZQ3hN5HHVtzgrTx__9-seNTzRIjGAtiCNsGdIyxlWOxGESUpE9RjbxbC3Cp6g01aBJtABPBpBqO7oFUojvJhhgvMKfQxPHYSrGH8cBtctAbq6jyr8CaafcfgFxt_HJALg24iScOmp0aAICAERWH443ors4a-30TiPnuUnxnc90RhYtme8Ybw5O9U6Q7HzZ8abL4w3fZpe-pfnv1vGq7VBIlVnqsoqEWGdlmmxS4oqq6K-zlWuct4JzkWGquNYlru06-QWu7RIt7tI1zzh2yTnZZpsd3kVV10qWyxFUahcZEnKtgkOQpvYmMswq4h0CBPWVbbNi8iIFk1Y_Mb5UnTG-Ww9X8_rN-10DmybGB0ofJxAmsxi0uOyIz_BJ3vHBP-tRpmt4brZkncb_uvsZh3-c7Nhc2-AaPKm_g6cpn5qY-kGxpv56vWzGb17QUmMN0smgfHmlsyl5l8DAAD__yiQUnM">