init.c (build_offset_ref): Don't call mark_used on an OVERLOAD.

* init.c (build_offset_ref): Don't call mark_used on an OVERLOAD.
	* decl.c (select_decl): Extract a lone function from an OVERLOAD.
	(lookup_namespace_name): Likewise.
	* typeck.c (build_unary_op): Not here anymore.
	* decl2.c (do_class_using_decl): Make sure we get an identifier.
	* class.c (handle_using_decl): Ignore TYPE_DECLs.

From-SVN: r21219
This commit is contained in:
Jason Merrill 1998-07-16 17:48:39 +00:00 committed by Jason Merrill
parent 52c11ef6a3
commit 1c35f5b6a0
6 changed files with 37 additions and 12 deletions

View File

@ -1,5 +1,13 @@
1998-07-16 Jason Merrill <jason@yorick.cygnus.com>
* init.c (build_offset_ref): Don't call mark_used on an OVERLOAD.
* decl.c (select_decl): Extract a lone function from an OVERLOAD.
(lookup_namespace_name): Likewise.
* typeck.c (build_unary_op): Not here anymore.
* decl2.c (do_class_using_decl): Make sure we get an identifier.
* class.c (handle_using_decl): Ignore TYPE_DECLs.
* decl.c (qualify_lookup): New fn.
(lookup_name_real): Use it.

View File

@ -1381,6 +1381,10 @@ handle_using_decl (using_decl, t, method_vec, fields)
OVL_CURRENT (TREE_VEC_ELT (method_vec, i)));
return;
}
if (! DECL_LANG_SPECIFIC (fdecl))
/* We don't currently handle DECL_ACCESS for TYPE_DECLs; just return. */
return;
for (tmp = fields; tmp; tmp = TREE_CHAIN (tmp))
if (DECL_NAME (tmp) == name)

View File

@ -4650,7 +4650,15 @@ lookup_namespace_name (namespace, name)
return error_mark_node;
if (BINDING_VALUE (val))
return BINDING_VALUE (val);
{
val = BINDING_VALUE (val);
/* If we have a single function from a using decl, pull it out. */
if (TREE_CODE (val) == OVERLOAD && ! really_overloaded_fn (val))
val = OVL_FUNCTION (val);
return val;
}
cp_error ("`%D' undeclared in namespace `%D'", name, namespace);
return error_mark_node;
}
@ -4760,6 +4768,11 @@ select_decl (binding, flags)
else if (val && LOOKUP_TYPES_ONLY (flags) && TREE_CODE (val) != TYPE_DECL
&& (!looking_for_template || TREE_CODE (val) != TEMPLATE_DECL))
val = NULL_TREE;
/* If we have a single function from a using decl, pull it out. */
if (val && TREE_CODE (val) == OVERLOAD && ! really_overloaded_fn (val))
val = OVL_FUNCTION (val);
return val;
}

View File

@ -3985,7 +3985,7 @@ ambiguous_decl (name, old, new, flags)
type = NULL_TREE;
if (!BINDING_TYPE (old))
BINDING_TYPE (old) = type;
else if(type && BINDING_TYPE (old) != type)
else if (type && BINDING_TYPE (old) != type)
{
if (flags & LOOKUP_COMPLAIN)
{
@ -4604,6 +4604,10 @@ do_class_using_decl (decl)
cp_error ("using-declaration for destructor");
return NULL_TREE;
}
if (TREE_CODE (name) == TYPE_DECL)
name = DECL_NAME (name);
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 980716);
value = build_lang_field_decl (USING_DECL, name, void_type_node);
DECL_INITIAL (value) = TREE_OPERAND (decl, 0);

View File

@ -1540,8 +1540,12 @@ build_offset_ref (type, name)
if (TREE_CODE (type) == NAMESPACE_DECL)
{
t = lookup_namespace_name (type, name);
mark_used (t);
return convert_from_reference (t);
if (! type_unknown_p (t))
{
mark_used (t);
t = convert_from_reference (t);
}
return t;
}
if (type == NULL_TREE || ! is_aggr_type (type, 1))

View File

@ -4547,14 +4547,6 @@ build_unary_op (code, xarg, noconvert)
return build1 (ADDR_EXPR, unknown_type_node, arg);
}
/* If we have a single function from a using decl, pull it out. */
if (TREE_CODE (arg) == OVERLOAD
&& ! really_overloaded_fn (arg))
{
arg = OVL_FUNCTION (arg);
argtype = TREE_TYPE (arg);
}
if (TREE_CODE (arg) == OVERLOAD
|| (TREE_CODE (arg) == OFFSET_REF
&& TREE_CODE (TREE_OPERAND (arg, 1)) == TEMPLATE_ID_EXPR))