This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[c++ patch] (was Re: member templates and default parameter)
- To: Tim Hollebeek <tim at hollebeek dot com>
- Subject: [c++ patch] (was Re: member templates and default parameter)
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Sun, 25 Mar 2001 21:47:45 -0500
- Cc: Nathan Sidwell <nathan at codesourcery dot com>, Stefan Seefeld <seefeld at sympatico dot ca>, gcc-patches at gcc dot gnu dot org
- References: <3AB95419.E6FD6F90@sympatico.ca> <3AB9C560.1C036F99@codesourcery.com> <20010322084821.A32583@cj44686-b.reston1.va.home.com> <20010323173737.A16369@disaster.jaj.com>
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'";