diff options
author | Giovanni Bajo <giovannibajo@gcc.gnu.org> | 2003-12-07 15:23:31 +0000 |
---|---|---|
committer | Giovanni Bajo <giovannibajo@gcc.gnu.org> | 2003-12-07 15:23:31 +0000 |
commit | 9f6a794d626563787e7ed032ae56c005c2a50d6c (patch) | |
tree | cceed65ec08f95207104d09da9520944043f5c66 /gcc/cp/name-lookup.c | |
parent | 1f866b457dcc4257bb7c79b0eae9403faf9a33ff (diff) | |
download | gcc-9f6a794d626563787e7ed032ae56c005c2a50d6c.zip gcc-9f6a794d626563787e7ed032ae56c005c2a50d6c.tar.gz gcc-9f6a794d626563787e7ed032ae56c005c2a50d6c.tar.bz2 |
re PR c++/2294 (using declaration confusion)
PR c++/2294
* name-lookup.c (push_overloaded_decl): Always construct an
OVERLOAD unless the declaration is a built-in.
(set_namespace_binding): While binding OVERLOADs with only one
declaration, we still need to call supplement_binding.
* init.c (build_new_1): Deal with an OVERLOAD set when
looking up for _Jv_AllocObject.
* except.c (build_throw): Likewise for _Jv_Throw.
From-SVN: r74394
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index a31aeeb..203cb1b 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -2002,7 +2002,11 @@ push_overloaded_decl (tree decl, int flags) } } - if (old || TREE_CODE (decl) == TEMPLATE_DECL) + /* FIXME: We should build OVERLOADs for all function declarations here. + But right now, there are too many places where the code creates an + artificial declaration and expects the name to be bound exactly + to a FUNCTION_DECL. */ + if (!DECL_ARTIFICIAL (decl)) { if (old && TREE_CODE (old) != OVERLOAD) new_binding = ovl_cons (decl, ovl_cons (old, NULL_TREE)); @@ -2012,7 +2016,6 @@ push_overloaded_decl (tree decl, int flags) OVL_USED (new_binding) = 1; } else - /* NAME is not ambiguous. */ new_binding = decl; if (doing_global) @@ -2870,7 +2873,11 @@ set_namespace_binding (tree name, tree scope, tree val) if (scope == NULL_TREE) scope = global_namespace; b = binding_for_name (NAMESPACE_LEVEL (scope), name); - if (!b->value || TREE_CODE (val) == OVERLOAD || val == error_mark_node) + if (!b->value + /* If OVL_CHAIN is NULL, it's the first FUNCTION_DECL for this name, + and we still need to call supplement_binding. */ + || (TREE_CODE (val) == OVERLOAD && OVL_CHAIN (val)) + || val == error_mark_node) b->value = val; else supplement_binding (b, val); |