[llvm-bugs] [Bug 31078] New: unexpected "use of overloaded operator '==' is ambiguous"
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Nov 20 01:31:35 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=31078
Bug ID: 31078
Summary: unexpected "use of overloaded operator '==' is
ambiguous"
Product: clang
Version: 3.9
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: blastrock at free.fr
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
The following program compiles on clang 3.8, gcc 6.1 and msvc 19 but not on
clang 3.9 and trunk 287442:
struct Master
{
};
struct A : Master
{
using Master::Master;
};
bool operator==(A, A) { return true; }
struct B : Master
{
using Master::Master;
B() {}
B(A) {}
};
bool operator==(B, B) { return true; }
int main(int argc, char* argv[])
{
A a;
B b;
a == b;
}
It says that there are two candidates for the operator== call at the end of
main. Since there is no possible conversion from B to A, the only correct
overload should be the one with B arguments.
I am not sure but it seems that clang accepts constructing an A from a Master.
This line compiles on clang 3.9 but not on gcc 6 and msvc 19:
A aa = Master{};
I don't know what the standard says and which compiler is correct though...
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161120/5fca4b1c/attachment.html>
More information about the llvm-bugs
mailing list