https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114771
Bug ID: 114771 Summary: GCC accepts invalid overloading of member function differing only in ref qualifier Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlame646 at gmail dot com Target Milestone: --- The following invalid program is accepted by gcc and clang: https://godbolt.org/z/8b5bKxxnn ``` #include <concepts> struct s { int f(auto...)&; void f(auto...); // clang ok, gcc ok, msvc nope }; static_assert(std::same_as<decltype(s{}.f()), void>); ``` c++20 over.load https://timsong-cpp.github.io/cppwp/n4868/over.load#2.3 says: > Member function declarations with the same name, the same parameter-type-list > ([dcl.fct]), and the same trailing requires-clause (if any), as well as > member function template declarations with the same name, the same > parameter-type-list, the same trailing requires-clause (if any), and the same > template-head, cannot be overloaded if any of them, but not all, have a > ref-qualifier ([dcl.fct]).