public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/marxin-gcc-benchmark-branch)] c++: Fix useless using-declaration.
@ 2020-03-30 11:02 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2020-03-30 11:02 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9a0c4f5b373e236cb4af5491f50862d41fd8775a
commit 9a0c4f5b373e236cb4af5491f50862d41fd8775a
Author: Jason Merrill <jason@redhat.com>
Date: Thu Feb 13 16:56:08 2020 +0100
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.
Diff:
---
gcc/cp/ChangeLog | 4 ++++
gcc/cp/name-lookup.c | 6 ++++--
gcc/testsuite/g++.dg/lookup/using62.C | 3 +++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8d7d91ce719..793e4afffcb 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 2a9bae53162..e5638d2df91 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -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),
diff --git a/gcc/testsuite/g++.dg/lookup/using62.C b/gcc/testsuite/g++.dg/lookup/using62.C
new file mode 100644
index 00000000000..e7a952ace08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using62.C
@@ -0,0 +1,3 @@
+template <class T> T bar ();
+void bar () {}
+using :: bar;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-30 11:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 11:02 [gcc(refs/users/marxin/heads/marxin-gcc-benchmark-branch)] c++: Fix useless using-declaration Martin Liska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).