Commit 00aeceec by Mark Mitchell

cp-tree.h (get_template_base): Don't declare.

	* cp-tree.h (get_template_base): Don't declare.
	(dfs_walk): Declare.
	(dfs_unmark): Likewise.
	(markedp): Likewise.
	* pt.c (unify): Remove duplicate declaration.  Pass tparms and
	targs to get_template_base.
	(get_template_base_recursive): Move here from search.c.  Check to
	see that the base found can be instantiated to form the desired
	type.
	(get_template_base): Likewise.
	(get_class_bindings): Simplify.
	* search.c (get_template_base_recursive): Move to pt.c.
	(get_template_base): Likewise.
	(markedp): Make it global.
	(dfs_walk): Likewise.
	(dfs_unmark): Likewise.

From-SVN: r25128
parent a3b3fa5e
...@@ -136,9 +136,9 @@ static tree process_partial_specialization PROTO((tree)); ...@@ -136,9 +136,9 @@ static tree process_partial_specialization PROTO((tree));
static void set_current_access_from_decl PROTO((tree)); static void set_current_access_from_decl PROTO((tree));
static void check_default_tmpl_args PROTO((tree, tree, int, int)); static void check_default_tmpl_args PROTO((tree, tree, int, int));
static tree tsubst_call_declarator_parms PROTO((tree, tree, tree)); static tree tsubst_call_declarator_parms PROTO((tree, tree, tree));
static tree get_template_base_recursive PROTO((tree, tree, int *, tree, tree, static tree get_template_base_recursive PROTO((tree, tree, tree, tree,
tree, int)); tree, int));
static tree get_template_base PROTO((tree, tree, int *, tree, tree)); static tree get_template_base PROTO((tree, tree, tree, tree));
/* We use TREE_VECs to hold template arguments. If there is only one /* We use TREE_VECs to hold template arguments. If there is only one
level of template arguments, then the TREE_VEC contains the level of template arguments, then the TREE_VEC contains the
...@@ -7365,12 +7365,11 @@ try_one_overload (tparms, orig_targs, targs, parm, arg, strict, ...@@ -7365,12 +7365,11 @@ try_one_overload (tparms, orig_targs, targs, parm, arg, strict,
/* Subroutine of get_template_base. */ /* Subroutine of get_template_base. */
static tree static tree
get_template_base_recursive (tparms, targs, explicit_mask, get_template_base_recursive (tparms, targs,
binfo, rval, template, binfo, rval, template,
via_virtual) via_virtual)
tree tparms; tree tparms;
tree targs; tree targs;
int *explicit_mask;
tree binfo; tree binfo;
tree rval; tree rval;
tree template; tree template;
...@@ -7384,22 +7383,15 @@ get_template_base_recursive (tparms, targs, explicit_mask, ...@@ -7384,22 +7383,15 @@ get_template_base_recursive (tparms, targs, explicit_mask,
if (CLASSTYPE_TEMPLATE_INFO (type) if (CLASSTYPE_TEMPLATE_INFO (type)
&& CLASSTYPE_TI_TEMPLATE (type) == tmpl) && CLASSTYPE_TI_TEMPLATE (type) == tmpl)
{ {
/* Copy the TPARMS and TARGS since we're only doing a
speculative unification here. */
tree copy_of_tparms;
tree copy_of_targs;
push_momentary (); push_momentary ();
push_expression_obstack ();
copy_of_tparms = copy_node (tparms);
copy_of_targs = copy_node (targs);
pop_obstacks ();
i = unify (copy_of_tparms, i = unify (tparms,
copy_of_targs, /* Use a temporary vector since we're doing
speculative unification here. */
make_temp_vec (TREE_VEC_LENGTH (targs)),
CLASSTYPE_TI_ARGS (template), CLASSTYPE_TI_ARGS (template),
CLASSTYPE_TI_ARGS (type), CLASSTYPE_TI_ARGS (type),
UNIFY_ALLOW_NONE, explicit_mask); UNIFY_ALLOW_NONE, 0);
pop_momentary (); pop_momentary ();
...@@ -7431,7 +7423,7 @@ get_template_base_recursive (tparms, targs, explicit_mask, ...@@ -7431,7 +7423,7 @@ get_template_base_recursive (tparms, targs, explicit_mask,
if (! this_virtual) if (! this_virtual)
SET_BINFO_MARKED (base_binfo); SET_BINFO_MARKED (base_binfo);
rval = get_template_base_recursive (tparms, targs, explicit_mask, rval = get_template_base_recursive (tparms, targs,
base_binfo, rval, base_binfo, rval,
template, this_virtual); template, this_virtual);
if (rval == error_mark_node) if (rval == error_mark_node)
...@@ -7449,10 +7441,9 @@ get_template_base_recursive (tparms, targs, explicit_mask, ...@@ -7449,10 +7441,9 @@ get_template_base_recursive (tparms, targs, explicit_mask,
template type. Used by unify. */ template type. Used by unify. */
static tree static tree
get_template_base (tparms, targs, explicit_mask, template, binfo) get_template_base (tparms, targs, template, binfo)
tree tparms; tree tparms;
tree targs; tree targs;
int *explicit_mask;
tree template; tree template;
tree binfo; tree binfo;
{ {
...@@ -7468,7 +7459,7 @@ get_template_base (tparms, targs, explicit_mask, template, binfo) ...@@ -7468,7 +7459,7 @@ get_template_base (tparms, targs, explicit_mask, template, binfo)
else else
my_friendly_abort (92); my_friendly_abort (92);
rval = get_template_base_recursive (tparms, targs, explicit_mask, rval = get_template_base_recursive (tparms, targs,
binfo, NULL_TREE, binfo, NULL_TREE,
template, 0); template, 0);
dfs_walk (binfo, dfs_unmark, markedp); dfs_walk (binfo, dfs_unmark, markedp);
...@@ -7882,8 +7873,7 @@ unify (tparms, targs, parm, arg, strict, explicit_mask) ...@@ -7882,8 +7873,7 @@ unify (tparms, targs, parm, arg, strict, explicit_mask)
The call to get_template_base also handles the case The call to get_template_base also handles the case
where PARM and ARG are the same type, i.e., where no where PARM and ARG are the same type, i.e., where no
derivation is involved. */ derivation is involved. */
t = get_template_base (tparms, targs, explicit_mask, t = get_template_base (tparms, targs, parm, arg);
parm, arg);
else if (CLASSTYPE_TEMPLATE_INFO (arg) else if (CLASSTYPE_TEMPLATE_INFO (arg)
&& (CLASSTYPE_TI_TEMPLATE (parm) && (CLASSTYPE_TI_TEMPLATE (parm)
== CLASSTYPE_TI_TEMPLATE (arg))) == CLASSTYPE_TI_TEMPLATE (arg)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment