aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-02-16 14:01:49 -0500
committerJason Merrill <jason@gcc.gnu.org>2016-02-16 14:01:49 -0500
commit7128d6ab21878794ac2107961338fc8621536a40 (patch)
tree41b17557337b02e51200aaf86dbe7f1eddc56eeb /gcc/cp/name-lookup.c
parent7005800cd120168075924fe4aa254b6f80c500c7 (diff)
downloadgcc-7128d6ab21878794ac2107961338fc8621536a40.zip
gcc-7128d6ab21878794ac2107961338fc8621536a40.tar.gz
gcc-7128d6ab21878794ac2107961338fc8621536a40.tar.bz2
re PR c++/69657 (abs() not inlined after including math.h)
PR c++/69657 * name-lookup.c (lookup_qualified_name): Add find_hidden parm. (set_decl_namespace): Pass it. Complain about finding a hidden friend. * name-lookup.h: Adjust. From-SVN: r233470
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index b5961e5..b73f3f7 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3502,7 +3502,8 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
}
/* See whether this has been declared in the namespace. */
- old = lookup_qualified_name (scope, DECL_NAME (decl), false, true);
+ old = lookup_qualified_name (scope, DECL_NAME (decl), /*type*/false,
+ /*complain*/true, /*hidden*/true);
if (old == error_mark_node)
/* No old declaration at all. */
goto complain;
@@ -3565,6 +3566,12 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
{
if (!is_associated_namespace (scope, CP_DECL_CONTEXT (found)))
goto complain;
+ if (DECL_HIDDEN_FRIEND_P (found))
+ {
+ pedwarn (DECL_SOURCE_LOCATION (decl), 0,
+ "%qD has not been declared within %D", decl, scope);
+ inform (DECL_SOURCE_LOCATION (found), "only here as a friend");
+ }
DECL_CONTEXT (decl) = DECL_CONTEXT (found);
return;
}
@@ -4509,11 +4516,15 @@ unqualified_namespace_lookup (tree name, int flags)
neither a class-type nor a namespace a diagnostic is issued. */
tree
-lookup_qualified_name (tree scope, tree name, bool is_type_p, bool complain)
+lookup_qualified_name (tree scope, tree name, bool is_type_p, bool complain,
+ bool find_hidden)
{
int flags = 0;
tree t = NULL_TREE;
+ if (find_hidden)
+ flags |= LOOKUP_HIDDEN;
+
if (TREE_CODE (scope) == NAMESPACE_DECL)
{
struct scope_binding binding = EMPTY_SCOPE_BINDING;