This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
eb22
- To: egcs-patches at cygnus dot com
- Subject: eb22
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Tue, 2 Jun 1998 10:06:30 +0200
As far as I can tell, g++ is right in reporting this as ambiguous.
Martin
Index: eb22.C
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/testsuite/g++.old-deja/g++.robertl/eb22.C,v
retrieving revision 1.1
diff -c -p -r1.1 eb22.C
*** eb22.C 1998/05/27 23:00:35 1.1
--- eb22.C 1998/06/02 08:02:32
***************
*** 1,5 ****
! // Build don't link:
! // XFAIL, doesn't.
class MyInt
{
--- 1,7 ----
! // Ambiguous conversion, three candidates:
! // builtin == (int, int), and the two user-defined operators
! // Each one requires a user-defined ICS where another uses builtin conversions,
! // so none is the best viable function.
class MyInt
{
*************** public:
*** 9,24 ****
};
bool operator==(const MyInt& a, const int& b)
! {
return (int)a == b;
}
bool operator==(const MyInt& a, const MyInt& b)
! {
return (int)a == (int)b;
}
bool f()
{
! return 3 == MyInt();
! }
--- 11,26 ----
};
bool operator==(const MyInt& a, const int& b)
! { // ERROR - candidate
return (int)a == b;
}
bool operator==(const MyInt& a, const MyInt& b)
! { // ERROR - candidate
return (int)a == (int)b;
}
bool f()
{
! return 3 == MyInt(); // ERROR - ambiguous
! } // ERROR - no return value