decl.c (replace_defag): Undo previous change.

Sat Sep  6 10:20:27 1997  Mark Mitchell  <mmitchell@usa.net>

	* decl.c (replace_defag): Undo previous change.
	* lex.c (do_pending_defargs): Deal with member templates.

	* pt.c (is_member_template): Avoid crashing when passed a
	non-function argument.

From-SVN: r15131
This commit is contained in:
Mark Mitchell 1997-09-06 20:10:05 +00:00 committed by Jason Merrill
parent 98c1c66880
commit aa5f3bad3a
4 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,11 @@
Sat Sep 6 10:20:27 1997 Mark Mitchell <mmitchell@usa.net>
* decl.c (replace_defag): Undo previous change.
* lex.c (do_pending_defargs): Deal with member templates.
* pt.c (is_member_template): Avoid crashing when passed a
non-function argument.
Fri Sep 5 17:27:38 1997 Jason Merrill <jason@yorick.cygnus.com>
* class.c (grow_method): Remove check for redeclaration.

View File

@ -10070,7 +10070,7 @@ void
replace_defarg (arg, init)
tree arg, init;
{
if (! processing_template_decl && ! uses_template_parms (TREE_VALUE (arg))
if (! processing_template_decl
&& ! can_convert_arg (TREE_VALUE (arg), TREE_TYPE (init), init))
cp_pedwarn ("invalid type `%T' for default argument to `%T'",
TREE_TYPE (init), TREE_VALUE (arg));

View File

@ -1873,6 +1873,8 @@ do_pending_defargs ()
push_nested_class (TREE_PURPOSE (defarg_fns), 1);
pushlevel (0);
if (is_member_template (defarg_fn))
begin_member_template_processing (DECL_TI_ARGS (defarg_fn));
if (TREE_CODE (defarg_fn) == FUNCTION_DECL)
{
@ -1899,6 +1901,8 @@ do_pending_defargs ()
return;
}
if (is_member_template (defarg_fn))
end_member_template_processing ();
poplevel (0, 0, 0);
pop_nested_class (1);
}

View File

@ -132,6 +132,12 @@ is_member_template (t)
{
int r = 0;
if (TREE_CODE (t) != FUNCTION_DECL
&& !DECL_FUNCTION_TEMPLATE_P (t))
/* Anything that isn't a template or a template functon is
certainly not a member template. */
return 0;
if (DECL_FUNCTION_MEMBER_P (t) ||
(TREE_CODE (t) == TEMPLATE_DECL &&
DECL_FUNCTION_MEMBER_P (DECL_TEMPLATE_RESULT (t))))