summaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-10 15:34:59 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-10 15:34:59 +0000
commitce20a5bdb5a7f81bb974210ae75bdde5913f60b1 (patch)
tree3663c16f5b1eac203bbfd48d713506551dc0295c /gcc/cp/name-lookup.c
parent2066d1f0c72b54080a7d65fe338197d1559d5275 (diff)
downloadgcc-ce20a5bdb5a7f81bb974210ae75bdde5913f60b1.tar.gz
PR c++/69657
* name-lookup.c (ambiguous_decl): Call remove_hidden_names. (lookup_name_real_1): Likewise. (remove_hidden_names): Handle non-functions too. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233278 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 227d6f22f44..8d6e75a1347 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4221,9 +4221,9 @@ ambiguous_decl (struct scope_binding *old, cxx_binding *new_binding, int flags)
val = new_binding->value;
if (val)
{
- if (hidden_name_p (val) && !(flags & LOOKUP_HIDDEN))
- val = NULL_TREE;
- else
+ if (!(flags & LOOKUP_HIDDEN))
+ val = remove_hidden_names (val);
+ if (val)
switch (TREE_CODE (val))
{
case TEMPLATE_DECL:
@@ -4353,7 +4353,7 @@ hidden_name_p (tree val)
return false;
}
-/* Remove any hidden friend functions from a possibly overloaded set
+/* Remove any hidden declarations from a possibly overloaded set
of functions. */
tree
@@ -4362,7 +4362,7 @@ remove_hidden_names (tree fns)
if (!fns)
return fns;
- if (TREE_CODE (fns) == FUNCTION_DECL && hidden_name_p (fns))
+ if (DECL_P (fns) && hidden_name_p (fns))
fns = NULL_TREE;
else if (TREE_CODE (fns) == OVERLOAD)
{
@@ -4931,6 +4931,10 @@ lookup_name_real_1 (tree name, int prefer_type, int nonclass, bool block_p,
if (!val)
val = unqualified_namespace_lookup (name, flags);
+ /* Anticipated built-ins and friends aren't found by normal lookup. */
+ if (val && !(flags & LOOKUP_HIDDEN))
+ val = remove_hidden_names (val);
+
/* 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);