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]
Other format: [Raw text]

Re: [C++] My unreviewed patch


Kriang Lerdsuwanakij wrote:
Hi

The following patch of mine is still not reviewed:

http://gcc.gnu.org/ml/gcc-patches/2004-09/msg00557.html

It implements a missing friend feature (mentioned in section
14.5.3/6) I intended to have in GCC 4.0.

Looks ok apart from some issues with the diagnostic text. Can you use the new %qD and related quoted printing formatters?



+       if (parm_list
+ 	  && !comp_template_parms (DECL_TEMPLATE_PARMS (tmpl), parm_list))
+ 	{
+ 	  if (complain & tf_error)
+ 	    error ("template parameter not match");
+ 	  return error_mark_node;
+ 	}

Something with more context would be better
   cp_error "template parameters do not match template"
   cp_error_at "declared here", tmpl
It's a pity we can't actuall print out the mismatching template
parameters.

! 	      decl = lookup_member (ctype, TYPE_IDENTIFIER (friend_type),
! 				    0, true);
! 	      if (!decl)
! 		{
! 		  error ("cannot find `%T'", friend_type);
! 		  return;
! 		}
! 	      if (template_member_p && !DECL_CLASS_TEMPLATE_P (decl))
! 		{
! 		  error ("cannot find template `%T'", friend_type);
! 		  return;
! 		}
! 	      if (!template_member_p && (TREE_CODE (decl) != TYPE_DECL
! 					 || !CLASS_TYPE_P (TREE_TYPE (decl))))
! 		{
! 		  error ("cannot find type `%T'", friend_type);
! 		  return;
! 		}

These would be better as something like
	"%qT is not a member of %qT", friend_type, ctype
that way the user gets a clue as to where the compiler was looking.

ok with those changes. If you want to run the diagnostics by me, feel
free to do so.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



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