This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66914] New: incorrect template partial ordering prefers non-member function instead of being 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: Fri, 17 Jul 2015 14:16:12 +0000
- Subject: [Bug c++/66914] New: incorrect template partial ordering prefers non-member function instead of being ambiguous
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66914
Bug ID: 66914
Summary: incorrect template partial ordering prefers non-member
function instead of being ambiguous
Product: gcc
Version: 5.1.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: ---
The following code:
#include <iostream>
template <typename N>
struct A {
template <typename T>
void operator+(T const&) {
std::cout << "member\n";
}
};
template <typename N>
void operator+(A<N>&, int const& ) {
std::cout << "free\n";
}
int main()
{
A<int> a;
a + 2;
}
compiles and prints "free". It should be ambiguous as neither function template
is more specialized than the other.