This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/78291] New: overload resolution prefers non-member operator to member operator when should be ambiguous
- From: "barry.revzin at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 10 Nov 2016 15:53:30 +0000
- Subject: [Bug c++/78291] New: overload resolution prefers non-member operator to member operator when should be ambiguous
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78291
Bug ID: 78291
Summary: overload resolution prefers non-member operator to
member operator when should be ambiguous
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This example:
struct A {
template <class T>
void operator==(T const& ) const;
template <class T>
friend void operator==(T const&, A const& ) { }
};
int main() {
A{} == A{};
}
compiles and runs (tried 4.8.2, 5.4, 6.2, and 7.0). gcc picks the non-member
overload here. But both overloads are equally viable, so this should be
ambiguous.