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]

PATCH for bad error message



Given:

  typedef int I[];

  void f(I&)
  {
  }

we used to say:

  test5.C:4: parameter type `int (&)[]' includes pointer to array of
  unknown bound

Pointers, what pointers?  This patch causes us to use `reference'
instead, if appropriate.

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

1998-09-08  Mark Mitchell  <mark@markmitchell.com>

	* decl.c (grokparms): Distinguish between references and pointers
	in error message.

Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.206
diff -c -p -r1.206 decl.c
*** decl.c	1998/09/07 14:25:02	1.206
--- decl.c	1998/09/08 17:01:09
*************** grokparms (first_parm, funcdef_flag)
*** 10916,10923 ****
  				 && TYPE_DOMAIN (t) != NULL_TREE))
  			t = TREE_TYPE (t);
  		      if (TREE_CODE (t) == ARRAY_TYPE)
! 			cp_error ("parameter type `%T' includes pointer to array of unknown bound",
! 				  type);
  		    }
  		}
  
--- 10916,10924 ----
  				 && TYPE_DOMAIN (t) != NULL_TREE))
  			t = TREE_TYPE (t);
  		      if (TREE_CODE (t) == ARRAY_TYPE)
! 			cp_error ("parameter type `%T' includes %s to array of unknown bound",
! 				  type,
! 				  TYPE_PTR_P (type) ? "pointer" : "reference");
  		    }
  		}
  


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