[C++] fix bug 184

Nathan Sidwell nathan@codesourcery.com
Wed Aug 9 03:04:00 GMT 2000


Hi,
I've installed the attached which fixes trivial bug 184.
built & tested on i686-pc-linux-gnu, approved by Mark.

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-08-08  Nathan Sidwell  <nathan@codesourcery.com>

	* cvt.c (convert_to_pointer_force): Fix error message when
	attempting to cast from ambiguous base.

Index: cp/cvt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cvt.c,v
retrieving revision 1.85
diff -c -3 -p -r1.85 cvt.c
*** cvt.c	2000/06/30 07:16:34	1.85
--- cvt.c	2000/08/08 15:43:57
*************** convert_to_pointer_force (type, expr)
*** 307,316 ****
  					    TREE_TYPE (intype), 0, &path);
  	  if (distance == -2)
  	    {
! 	    ambig:
! 	      cp_error ("type `%T' is ambiguous baseclass of `%s'",
  			TREE_TYPE (type),
! 			TYPE_NAME_STRING (TREE_TYPE (intype)));
  	      return error_mark_node;
  	    }
  	  if (distance == -1)
--- 307,315 ----
  					    TREE_TYPE (intype), 0, &path);
  	  if (distance == -2)
  	    {
! 	      cp_error ("type `%T' is ambiguous base of `%T'",
  			TREE_TYPE (type),
! 			TREE_TYPE (intype));
  	      return error_mark_node;
  	    }
  	  if (distance == -1)
*************** convert_to_pointer_force (type, expr)
*** 318,324 ****
  	      distance = get_base_distance (TREE_TYPE (intype),
  					    TREE_TYPE (type), 0, &path);
  	      if (distance == -2)
! 		goto ambig;
  	      if (distance < 0)
  		/* Doesn't need any special help from us.  */
  		return build1 (NOP_EXPR, type, expr);
--- 317,328 ----
  	      distance = get_base_distance (TREE_TYPE (intype),
  					    TREE_TYPE (type), 0, &path);
  	      if (distance == -2)
! 	        {
! 	          cp_error ("type `%T' is ambiguous base of `%T'",
! 			    TREE_TYPE (intype),
! 			    TREE_TYPE (type));
! 	          return error_mark_node;
! 	        }
  	      if (distance < 0)
  		/* Doesn't need any special help from us.  */
  		return build1 (NOP_EXPR, type, expr);


More information about the Gcc-patches mailing list