This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
(C++) patch for overload warning
- To: egcs-patches at cygnus dot com
- Subject: (C++) patch for overload warning
- From: Jason Merrill <jason at cygnus dot com>
- Date: Tue, 18 May 1999 18:15:02 -0700
We weren't warning about cases that we should. Such as g++.other/overcnv1.C.
1999-05-18 Jason Merrill <jason@yorick.cygnus.com>
* call.c (joust): Compare the types of the conv ops, not the
target types of the conversions.
Index: call.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/call.c,v
retrieving revision 1.144
diff -c -p -r1.144 call.c
*** call.c 1999/05/17 07:42:24 1.144
--- call.c 1999/05/19 01:14:08
*************** joust (cand1, cand2, warn)
*** 4341,4348 ****
!= DECL_CONSTRUCTOR_P (cand2->fn))
/* Don't warn if the two conv ops convert to the same type... */
|| (! DECL_CONSTRUCTOR_P (cand1->fn)
! && ! same_type_p (TREE_TYPE (cand1->second_conv),
! TREE_TYPE (cand2->second_conv)))))
{
int comp = compare_ics (cand1->second_conv, cand2->second_conv);
if (comp != winner)
--- 4341,4348 ----
!= DECL_CONSTRUCTOR_P (cand2->fn))
/* Don't warn if the two conv ops convert to the same type... */
|| (! DECL_CONSTRUCTOR_P (cand1->fn)
! && ! same_type_p (TREE_TYPE (TREE_TYPE (cand1->fn)),
! TREE_TYPE (TREE_TYPE (cand2->fn))))))
{
int comp = compare_ics (cand1->second_conv, cand2->second_conv);
if (comp != winner)