Commit 42c7b807 by Jason Merrill

class.c (finish_struct_1): Use OVL_CURRENT on TREE_VEC_ELT.

	* class.c (finish_struct_1): Use OVL_CURRENT on TREE_VEC_ELT.
	* decl2.c (constructor_name_full): Likewise.
	* tree.c (mapcar): Add OVERLOAD support.
	* init.c (resolve_offset_ref): We must use basetype_path before we
	destroy it with a call to convert_pointer_to.

From-SVN: r19656
parent e9b4fabf
Sun May 10 22:48:22 1998 H.J. Lu (hjl@gnu.org)
* class.c (finish_struct_1): Use OVL_CURRENT on TREE_VEC_ELT.
* decl2.c (constructor_name_full): Likewise.
Sun May 10 22:48:12 1998 Mike Stump <mrs@wrs.com>
* tree.c (mapcar): Add OVERLOAD support.
* init.c (resolve_offset_ref): We must use basetype_path before we
destroy it with a call to convert_pointer_to.
Sat May 9 14:44:37 1998 Jason Merrill <jason@yorick.cygnus.com> Sat May 9 14:44:37 1998 Jason Merrill <jason@yorick.cygnus.com>
* class.c (currently_open_class): New fn. * class.c (currently_open_class): New fn.
......
...@@ -3705,7 +3705,8 @@ finish_struct_1 (t, warn_anon) ...@@ -3705,7 +3705,8 @@ finish_struct_1 (t, warn_anon)
name = DECL_NAME (fdecl); name = DECL_NAME (fdecl);
for (; i < n_methods; i++) for (; i < n_methods; i++)
if (DECL_NAME (TREE_VEC_ELT (method_vec, i)) == name) if (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i)))
== name)
{ {
cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t); cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
cp_error_at (" because of local method `%#D' with same name", cp_error_at (" because of local method `%#D' with same name",
...@@ -3821,7 +3822,8 @@ finish_struct_1 (t, warn_anon) ...@@ -3821,7 +3822,8 @@ finish_struct_1 (t, warn_anon)
continue; continue;
for (; i < n_methods; ++i) for (; i < n_methods; ++i)
if (DECL_NAME (TREE_VEC_ELT (method_vec, i)) == name) if (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i)))
== name)
{ {
cp_error_at ("data member `%#D' conflicts with", x); cp_error_at ("data member `%#D' conflicts with", x);
cp_error_at ("function member `%#D'", cp_error_at ("function member `%#D'",
......
...@@ -1097,6 +1097,16 @@ struct lang_decl ...@@ -1097,6 +1097,16 @@ struct lang_decl
((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \ ((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \
? DECL_CLASS_CONTEXT (NODE) : DECL_CONTEXT (NODE)) ? DECL_CLASS_CONTEXT (NODE) : DECL_CONTEXT (NODE))
/* 1 iff NODE has namespace scope, including the global namespace. */
#define DECL_NAMESPACE_SCOPE(NODE) \
(DECL_CONTEXT (NODE) == NULL_TREE \
|| TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
/* 1 iff NODE is a class member. */
#define DECL_CLASS_SCOPE(NODE) \
(DECL_CONTEXT (NODE) \
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
/* For a NAMESPACE_DECL: the list of using namespace directives /* For a NAMESPACE_DECL: the list of using namespace directives
The PURPOSE is the used namespace, the value is the namespace The PURPOSE is the used namespace, the value is the namespace
that is the common ancestor. */ that is the common ancestor. */
......
...@@ -1982,7 +1982,7 @@ constructor_name_full (thing) ...@@ -1982,7 +1982,7 @@ constructor_name_full (thing)
else if (IS_AGGR_TYPE_CODE (TREE_CODE (thing))) else if (IS_AGGR_TYPE_CODE (TREE_CODE (thing)))
{ {
if (TYPE_WAS_ANONYMOUS (thing) && TYPE_HAS_CONSTRUCTOR (thing)) if (TYPE_WAS_ANONYMOUS (thing) && TYPE_HAS_CONSTRUCTOR (thing))
thing = DECL_NAME (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (thing), 0)); thing = DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (thing), 0)));
else else
thing = TYPE_NAME (thing); thing = TYPE_NAME (thing);
} }
......
...@@ -1870,8 +1870,10 @@ resolve_offset_ref (exp) ...@@ -1870,8 +1870,10 @@ resolve_offset_ref (exp)
error_not_base_type (basetype, TREE_TYPE (TREE_TYPE (base))); error_not_base_type (basetype, TREE_TYPE (TREE_TYPE (base)));
return error_mark_node; return error_mark_node;
} }
addr = convert_pointer_to (basetype, base); /* Kludge: we need to use basetype_path now, because
convert_pointer_to will bash it. */
access = compute_access (basetype_path, member); access = compute_access (basetype_path, member);
addr = convert_pointer_to (basetype, base);
if (access == access_public_node) if (access == access_public_node)
return build (COMPONENT_REF, TREE_TYPE (member), return build (COMPONENT_REF, TREE_TYPE (member),
build_indirect_ref (addr, NULL_PTR), member); build_indirect_ref (addr, NULL_PTR), member);
......
...@@ -1590,6 +1590,15 @@ mapcar (t, func) ...@@ -1590,6 +1590,15 @@ mapcar (t, func)
return t; return t;
} }
case OVERLOAD:
{
tree chain = OVL_CHAIN (t);
t = copy_node (t);
OVL_FUNCTION (t) = mapcar (OVL_FUNCTION (t), func);
OVL_CHAIN (t) = mapcar (chain, func);
return t;
}
case TREE_VEC: case TREE_VEC:
{ {
int len = TREE_VEC_LENGTH (t); int len = TREE_VEC_LENGTH (t);
......
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