[Clang] Unexpected Overloading of Static and Non-Static Member Functions (original) (raw)
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.
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
struct X { static void f(); void f() const; };
It fails as expected, please see Compiler Explorer.