public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114771] New: GCC accepts invalid overloading of member function differing only in ref qualifier
@ 2024-04-18 14:58 jlame646 at gmail dot com
2024-04-18 16:28 ` [Bug c++/114771] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: jlame646 at gmail dot com @ 2024-04-18 14:58 UTC (permalink / raw)
To: gcc-bugs
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]).
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/114771] GCC accepts invalid overloading of member function differing only in ref qualifier
2024-04-18 14:58 [Bug c++/114771] New: GCC accepts invalid overloading of member function differing only in ref qualifier jlame646 at gmail dot com
@ 2024-04-18 16:28 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-18 16:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114771
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
EDG also accepts this. so 3 out of 4 compilers out accept it. Maybe there is a
defect report ...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-18 16:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18 14:58 [Bug c++/114771] New: GCC accepts invalid overloading of member function differing only in ref qualifier jlame646 at gmail dot com
2024-04-18 16:28 ` [Bug c++/114771] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).