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] (was Re: member templates and default parameter)


On Thu, Mar 22, 2001 at 08:48:21AM -0500, Tim Hollebeek wrote:
> On Thu, Mar 22, 2001 at 09:26:56AM +0000, Nathan Sidwell wrote:
> > > 
> > > bash$ g++ -c templ.cc
> > > templ.cc:7: default argument for template parameter in function template `void
> > >    Bar::foo(T)'
> > 
> > not a bug
> 
> However the error message could be improved.  The current one is a
> sentence fragment stating a fact, which isn't particularly helpful.


How does this sound instead?  I took your suggested text for one change,
and followed its example for the other.

I can't tell what the error message for the final 'else' branch should be.
At the end of the same function, the exact same text is repeated, FWIW.


diff -x CVS -x .# -x *.info* -c3 egcscurrent/gcc/cp/pt.c egcschanging/gcc/cp/pt.c
*** egcscurrent/gcc/cp/pt.c	Sat Mar 24 01:34:43 2001
--- egcschanging/gcc/cp/pt.c	Sun Mar 25 19:39:19 2001
***************
*** 2432,2440 ****
  
    /* Figure out what error message to issue.  */
    if (TREE_CODE (decl) == FUNCTION_DECL)
!     msg = "default argument for template parameter in function template `%D'";
    else if (is_partial)
!     msg = "default argument in partial specialization `%D'";
    else
      msg = "default argument for template parameter for class enclosing `%D'";
  
--- 2432,2442 ----
  
    /* Figure out what error message to issue.  */
    if (TREE_CODE (decl) == FUNCTION_DECL)
!     msg = "in function template `%D':  default template arguments "
!           "may not be used in function templates";
    else if (is_partial)
!     msg = "in partial specialization `%D':  default template arguments "
!           "may not be used in partial specializations";
    else
      msg = "default argument for template parameter for class enclosing `%D'";
  


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