This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

eb22


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]