c++: redeclared hidden friend [PR105761]
commit284ae8b46f5eef74c0b660a87a7169497f559e73
authorJason Merrill <jason@redhat.com>
Fri, 3 Jun 2022 16:35:12 +0000 (3 12:35 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 3 Jun 2022 17:44:44 +0000 (3 13:44 -0400)
tree7360cdd27f31c55d3015b8b8591880ddc25c508b
parent44a5bd6d933d86ed988fc4695aa00f122cf83eb4
c++: redeclared hidden friend [PR105761]

Here, when we see the second declaration of f we match it with the first
one, copy over DECL_TEMPLATE_INFO, and then try to use it when parsing the
definition, leading to confusion.

PR c++/105761

gcc/cp/ChangeLog:

* decl.cc (duplicate_decls): Don't copy DECL_TEMPLATE_INFO
from a hidden friend.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/auto-fn64.C: New test.
gcc/cp/decl.cc
gcc/testsuite/g++.dg/cpp1y/auto-fn64.C [new file with mode: 0644]