aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGiovanni Bajo <giovannibajo@libero.it>2003-11-14 21:14:08 +0100
committerBernardo Innocenti <bernie@gcc.gnu.org>2003-11-14 21:14:08 +0100
commit2a91b33cb0c4c3e3c4bdd25a885c87c3f3721313 (patch)
tree09ea5083f981c548330b1887bc758f81ca9faf7f /gcc
parent8fecc9e903e1a2824eb52a59a819ebc3fbd1e9b4 (diff)
downloadgcc-2a91b33cb0c4c3e3c4bdd25a885c87c3f3721313.zip
gcc-2a91b33cb0c4c3e3c4bdd25a885c87c3f3721313.tar.gz
gcc-2a91b33cb0c4c3e3c4bdd25a885c87c3f3721313.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. From-SVN: r73618
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/name-lookup.c9
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6540d4d..e773b79 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2003-11-14 Giovanni Bajo <giovannibajo@libero.it>
+
+ 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.
+
2003-11-14 Mark Mitchell <mark@codesourcery.com>
PR c++/12762
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index a31aeeb..bb4b0ac 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -2002,7 +2002,7 @@ push_overloaded_decl (tree decl, int flags)
}
}
- if (old || TREE_CODE (decl) == TEMPLATE_DECL)
+ if (!DECL_ARTIFICIAL (decl))
{
if (old && TREE_CODE (old) != OVERLOAD)
new_binding = ovl_cons (decl, ovl_cons (old, NULL_TREE));
@@ -2012,7 +2012,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 +2869,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);