re PR c++/69657 (abs() not inlined after including math.h)

PR c++/69657

	* name-lookup.c (ambiguous_decl): Call remove_hidden_names.
	(lookup_name_real_1): Likewise.
	(remove_hidden_names): Handle non-functions too.

From-SVN: r233278
This commit is contained in:
Jason Merrill 2016-02-10 10:34:59 -05:00 committed by Jason Merrill
parent ff2faafcf6
commit 89908c8f2b
3 changed files with 28 additions and 5 deletions

View File

@ -1,5 +1,10 @@
2016-02-10 Jason Merrill <jason@redhat.com>
PR c++/69657
* name-lookup.c (ambiguous_decl): Call remove_hidden_names.
(lookup_name_real_1): Likewise.
(remove_hidden_names): Handle non-functions too.
PR c++/10200
* parser.c (cp_parser_lookup_name): When looking for a template
after . or ->, only consider class templates.

View File

@ -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);

View File

@ -0,0 +1,14 @@
// PR c++/69657
typedef unsigned int size_t;
namespace std {
extern void *calloc(size_t, size_t);
}
using std::calloc;
int
main ()
{
char *(*pfn) = (char *(*)) calloc ;
(bool)&calloc;
(bool)&::calloc;
}