[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    Re: [c++ bug] operator name revamp
From:       Mark Mitchell <mark () codesourcery ! com>
Date:       2000-05-30 17:59:35
[Download RAW message or body]


Thanks; fixed.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-05-30  Mark Mitchell  <mark@codesourcery.com>

	* call.c (joust): Fix handling of overloaded builtin operators.

Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/call.c,v
retrieving revision 1.217
diff -c -p -r1.217 call.c
*** call.c	2000/05/28 02:58:13	1.217
--- call.c	2000/05/30 17:38:06
*************** joust (cand1, cand2, warn)
*** 5128,5134 ****
        /* Kludge around broken overloading rules whereby
  	 Integer a, b; test ? a : b; is ambiguous, since there's a builtin
  	 that takes references and another that takes values.  */
!       if (DECL_OVERLOADED_OPERATOR_P (cand1->fn) == COND_EXPR)
  	{
  	  tree c1 = TREE_VEC_ELT (cand1->convs, 1);
  	  tree c2 = TREE_VEC_ELT (cand2->convs, 1);
--- 5128,5134 ----
        /* Kludge around broken overloading rules whereby
  	 Integer a, b; test ? a : b; is ambiguous, since there's a builtin
  	 that takes references and another that takes values.  */
!       if (cand1->fn == ansi_opname (COND_EXPR))
  	{
  	  tree c1 = TREE_VEC_ELT (cand1->convs, 1);
  	  tree c2 = TREE_VEC_ELT (cand2->convs, 1);
Index: testsuite/g++.old-deja/g++.other/overload13.C
===================================================================
RCS file: overload13.C
diff -N overload13.C
*** /dev/null	Tue May  5 13:32:27 1998
--- overload13.C	Tue May 30 10:38:07 2000
***************
*** 0 ****
--- 1,13 ----
+ // Build don't link:
+ // Origin: Nathan Sidwell <nathan@codesourcery.com>
+ 
+ struct A {
+   bool operator== (A const &);
+   operator bool () const;
+   operator int * () const;
+ };
+ 
+ bool foo (A &a1, A &a2)
+ {
+   return a1 == a2;
+ }

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic