diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-07-16 17:48:39 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-07-16 13:48:39 -0400 |
commit | 1c35f5b6a0b9e6fcc374f2edfb6703503817ce13 (patch) | |
tree | f8158dfa7be88a8b702a464e209aacbb73bc0121 /gcc | |
parent | 52c11ef6a3eb0e205899df0f54c1c41be31c8ae9 (diff) | |
download | gcc-1c35f5b6a0b9e6fcc374f2edfb6703503817ce13.zip gcc-1c35f5b6a0b9e6fcc374f2edfb6703503817ce13.tar.gz gcc-1c35f5b6a0b9e6fcc374f2edfb6703503817ce13.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/class.c | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 15 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 6 | ||||
-rw-r--r-- | gcc/cp/init.c | 8 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 8 |
6 files changed, 37 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1abd30d..85e8e05 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index cc53671..1c98b3b 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 0801ab8..8071386 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; } diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index bd32d62..5384e98 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 2f807997..dfe07b5 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -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)) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 644260a..2c1421e 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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)) |