diff options
author | Jason Merrill <jason@redhat.com> | 2020-02-13 16:56:08 +0100 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-02-13 22:32:13 +0100 |
commit | 9a0c4f5b373e236cb4af5491f50862d41fd8775a (patch) | |
tree | 2c478d716b305677a9f09433da422b1b672c01d5 /gcc | |
parent | abc79c6498a99e9c39e6056f432796c6dde3a887 (diff) | |
download | gcc-9a0c4f5b373e236cb4af5491f50862d41fd8775a.zip gcc-9a0c4f5b373e236cb4af5491f50862d41fd8775a.tar.gz gcc-9a0c4f5b373e236cb4af5491f50862d41fd8775a.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 6 | ||||
-rw-r--r-- | 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 8d7d91c..793e4af 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 2a9bae5..e5638d2 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 0000000..e7a952a --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using62.C @@ -0,0 +1,3 @@ +template <class T> T bar (); +void bar () {} +using :: bar; |