c++: Fix useless using-declaration.

Here reintroducing the same declarations into the global namespace via
using-declaration is useless but OK.  And a function and a function template
with the same parameters do not conflict.

gcc/cp/ChangeLog
2020-02-13  Jason Merrill  <jason@redhat.com>

	PR c++/93713
	* name-lookup.c (matching_fn_p): A function does not match a
	template.
This commit is contained in:
Jason Merrill 2020-02-13 16:56:08 +01:00
parent abc79c6498
commit 9a0c4f5b37
3 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2020-02-13 Jason Merrill <jason@redhat.com>
PR c++/93713
* name-lookup.c (matching_fn_p): A function does not match a
template.
PR c++/93643
PR c++/91476
* tree.c (decl_linkage): Always lk_none for locals.

View File

@ -2321,12 +2321,14 @@ update_local_overload (cxx_binding *binding, tree newval)
static bool
matching_fn_p (tree one, tree two)
{
if (TREE_CODE (one) != TREE_CODE (two))
return false;
if (!compparms (TYPE_ARG_TYPES (TREE_TYPE (one)),
TYPE_ARG_TYPES (TREE_TYPE (two))))
return false;
if (TREE_CODE (one) == TEMPLATE_DECL
&& TREE_CODE (two) == TEMPLATE_DECL)
if (TREE_CODE (one) == TEMPLATE_DECL)
{
/* Compare template parms. */
if (!comp_template_parms (DECL_TEMPLATE_PARMS (one),

View File

@ -0,0 +1,3 @@
template <class T> T bar ();
void bar () {}
using :: bar;