Commit 3ad97789 by Nathan Sidwell Committed by Nathan Sidwell

pt.c (instantiate_clone): Remove, fold into ...

	* pt.c (instantiate_clone): Remove, fold into ...
	(instantiate_template): ... here. Simplify by removing mutual
	recursion.
	* typeck2.c (build_m_component_ref): Don't cv qualify the function
	pointed to by a pointer to function.
	* class.c (delete_duplicate_fields_1): Typo.

From-SVN: r48155
parent f21add07
2001-12-18 Nathan Sidwell <nathan@codesourcery.com>
* pt.c (instantiate_clone): Remove, fold into ...
(instantiate_template): ... here. Simplify by removing mutual
recursion.
* typeck2.c (build_m_component_ref): Don't cv qualify the function
pointed to by a pointer to function.
* class.c (delete_duplicate_fields_1): Typo.
2001-12-18 Jason Merrill <jason@redhat.com> 2001-12-18 Jason Merrill <jason@redhat.com>
C++ ABI change: destroy value arguments in caller. C++ ABI change: destroy value arguments in caller.
......
...@@ -1074,7 +1074,7 @@ delete_duplicate_fields_1 (field, fields) ...@@ -1074,7 +1074,7 @@ delete_duplicate_fields_1 (field, fields)
} }
} }
else if (TREE_CODE (field) == USING_DECL) else if (TREE_CODE (field) == USING_DECL)
/* A using declaration may is allowed to appear more than /* A using declaration is allowed to appear more than
once. We'll prune these from the field list later, and once. We'll prune these from the field list later, and
handle_using_decl will complain about invalid multiple handle_using_decl will complain about invalid multiple
uses. */ uses. */
......
...@@ -162,7 +162,6 @@ static tree determine_specialization PARAMS ((tree, tree, tree *, int)); ...@@ -162,7 +162,6 @@ static tree determine_specialization PARAMS ((tree, tree, tree *, int));
static int template_args_equal PARAMS ((tree, tree)); static int template_args_equal PARAMS ((tree, tree));
static void tsubst_default_arguments PARAMS ((tree)); static void tsubst_default_arguments PARAMS ((tree));
static tree for_each_template_parm_r PARAMS ((tree *, int *, void *)); static tree for_each_template_parm_r PARAMS ((tree *, int *, void *));
static tree instantiate_clone PARAMS ((tree, tree));
static tree copy_default_args_to_explicit_spec_1 PARAMS ((tree, tree)); static tree copy_default_args_to_explicit_spec_1 PARAMS ((tree, tree));
static void copy_default_args_to_explicit_spec PARAMS ((tree)); static void copy_default_args_to_explicit_spec PARAMS ((tree));
static int invalid_nontype_parm_type_p PARAMS ((tree, int)); static int invalid_nontype_parm_type_p PARAMS ((tree, int));
...@@ -7533,43 +7532,6 @@ tsubst_expr (t, args, complain, in_decl) ...@@ -7533,43 +7532,6 @@ tsubst_expr (t, args, complain, in_decl)
return tsubst_expr (TREE_CHAIN (t), args, complain, in_decl); return tsubst_expr (TREE_CHAIN (t), args, complain, in_decl);
} }
/* TMPL is a TEMPLATE_DECL for a cloned constructor or destructor.
Instantiate it with the ARGS. */
static tree
instantiate_clone (tmpl, args)
tree tmpl;
tree args;
{
tree spec;
tree clone;
/* Instantiated the cloned function, rather than the clone. */
spec = instantiate_template (DECL_CLONED_FUNCTION (tmpl), args);
/* Then, see if we've already cloned the instantiation. */
for (clone = TREE_CHAIN (spec);
clone && DECL_CLONED_FUNCTION_P (clone);
clone = TREE_CHAIN (clone))
if (DECL_NAME (clone) == DECL_NAME (tmpl))
return clone;
/* If we haven't, do so know. */
if (!clone)
clone_function_decl (spec, /*update_method_vec_p=*/0);
/* Look again. */
for (clone = TREE_CHAIN (spec);
clone && DECL_CLONED_FUNCTION_P (clone);
clone = TREE_CHAIN (clone))
if (DECL_NAME (clone) == DECL_NAME (tmpl))
return clone;
/* We should always have found the clone by now. */
my_friendly_abort (20000411);
return NULL_TREE;
}
/* Instantiate the indicated variable or function template TMPL with /* Instantiate the indicated variable or function template TMPL with
the template arguments in TARG_PTR. */ the template arguments in TARG_PTR. */
...@@ -7577,7 +7539,6 @@ tree ...@@ -7577,7 +7539,6 @@ tree
instantiate_template (tmpl, targ_ptr) instantiate_template (tmpl, targ_ptr)
tree tmpl, targ_ptr; tree tmpl, targ_ptr;
{ {
tree clone;
tree fndecl; tree fndecl;
tree gen_tmpl; tree gen_tmpl;
tree spec; tree spec;
...@@ -7591,7 +7552,20 @@ instantiate_template (tmpl, targ_ptr) ...@@ -7591,7 +7552,20 @@ instantiate_template (tmpl, targ_ptr)
/* If this function is a clone, handle it specially. */ /* If this function is a clone, handle it specially. */
if (DECL_CLONED_FUNCTION_P (tmpl)) if (DECL_CLONED_FUNCTION_P (tmpl))
return instantiate_clone (tmpl, targ_ptr); {
tree spec = instantiate_template (DECL_CLONED_FUNCTION (tmpl), targ_ptr);
tree clone;
/* Look for the clone. */
for (clone = TREE_CHAIN (spec);
clone && DECL_CLONED_FUNCTION_P (clone);
clone = TREE_CHAIN (clone))
if (DECL_NAME (clone) == DECL_NAME (tmpl))
return clone;
/* We should always have found the clone by now. */
my_friendly_abort (20000411);
return NULL_TREE;
}
/* Check to see if we already have this specialization. */ /* Check to see if we already have this specialization. */
spec = retrieve_specialization (tmpl, targ_ptr); spec = retrieve_specialization (tmpl, targ_ptr);
...@@ -7642,11 +7616,11 @@ instantiate_template (tmpl, targ_ptr) ...@@ -7642,11 +7616,11 @@ instantiate_template (tmpl, targ_ptr)
add_pending_template (fndecl); add_pending_template (fndecl);
/* If we've just instantiated the main entry point for a function, /* If we've just instantiated the main entry point for a function,
instantiate all the alternate entry points as well. */ instantiate all the alternate entry points as well. We do this
for (clone = TREE_CHAIN (gen_tmpl); by cloning the instantiation of the main entry point, not by
clone && DECL_CLONED_FUNCTION_P (clone); instantiating the template clones. */
clone = TREE_CHAIN (clone)) if (TREE_CHAIN (gen_tmpl) && DECL_CLONED_FUNCTION_P (TREE_CHAIN (gen_tmpl)))
instantiate_template (clone, targ_ptr); clone_function_decl (fndecl, /*update_method_vec_p=*/0);
return fndecl; return fndecl;
} }
......
...@@ -1128,6 +1128,24 @@ build_m_component_ref (datum, component) ...@@ -1128,6 +1128,24 @@ build_m_component_ref (datum, component)
{ {
type = TREE_TYPE (TREE_TYPE (component)); type = TREE_TYPE (TREE_TYPE (component));
field_type = TREE_TYPE (type); field_type = TREE_TYPE (type);
/* Compute the type of the field, as described in [expr.ref]. */
type_quals = TYPE_UNQUALIFIED;
if (TREE_CODE (field_type) == REFERENCE_TYPE)
/* The standard says that the type of the result should be the
type referred to by the reference. But for now, at least,
we do the conversion from reference type later. */
;
else
{
type_quals = (cp_type_quals (field_type)
| cp_type_quals (TREE_TYPE (datum)));
/* There's no such thing as a mutable pointer-to-member, so
we don't need to deal with that here like we do in
build_component_ref. */
field_type = cp_build_qualified_type (field_type, type_quals);
}
} }
else else
{ {
...@@ -1138,8 +1156,8 @@ build_m_component_ref (datum, component) ...@@ -1138,8 +1156,8 @@ build_m_component_ref (datum, component)
if (! IS_AGGR_TYPE (objtype)) if (! IS_AGGR_TYPE (objtype))
{ {
error ("cannot apply member pointer `%E' to `%E'", component, datum); error ("cannot apply member pointer `%E' to `%E', which is of non-aggregate type `%T'",
error ("which is of non-aggregate type `%T'", objtype); component, datum, objtype);
return error_mark_node; return error_mark_node;
} }
...@@ -1154,23 +1172,6 @@ build_m_component_ref (datum, component) ...@@ -1154,23 +1172,6 @@ build_m_component_ref (datum, component)
else if (binfo == error_mark_node) else if (binfo == error_mark_node)
return error_mark_node; return error_mark_node;
/* Compute the type of the field, as described in [expr.ref]. */
type_quals = TYPE_UNQUALIFIED;
if (TREE_CODE (field_type) == REFERENCE_TYPE)
/* The standard says that the type of the result should be the
type referred to by the reference. But for now, at least, we
do the conversion from reference type later. */
;
else
{
type_quals = (cp_type_quals (field_type)
| cp_type_quals (TREE_TYPE (datum)));
/* There's no such thing as a mutable pointer-to-member, so we don't
need to deal with that here like we do in build_component_ref. */
field_type = cp_build_qualified_type (field_type, type_quals);
}
component = build (OFFSET_REF, field_type, datum, component); component = build (OFFSET_REF, field_type, datum, component);
if (TREE_CODE (type) == OFFSET_TYPE) if (TREE_CODE (type) == OFFSET_TYPE)
component = resolve_offset_ref (component); component = resolve_offset_ref (component);
......
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