This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [c++ bug] operator name revamp
- To: nathan at codesourcery dot com
- Subject: Re: [c++ bug] operator name revamp
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 30 May 2000 10:59:35 -0700
- Cc: gcc-bugs at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <3933E412.B0A27448@codesourcery.com>
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;
+ }