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]

(C++) patch for overload warning


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)


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