diff options
author | Jason Merrill <jason@redhat.com> | 2022-04-06 23:46:53 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-04-08 21:50:46 -0400 |
commit | 58586721c79f77224b8571a5dba732620d5546ab (patch) | |
tree | f6d8b7e5f5c980c13ff8c6c92e4c65693839de2d /gcc/config.gcc | |
parent | 405eda0d34b69fb6ee12ba6ed0f69c2c2411d8ee (diff) | |
download | gcc-58586721c79f77224b8571a5dba732620d5546ab.zip gcc-58586721c79f77224b8571a5dba732620d5546ab.tar.gz gcc-58586721c79f77224b8571a5dba732620d5546ab.tar.bz2 |
c++: friend implicit template instantiation [PR91618]
This rule that for a friend with a qualified name we try to find a
matching template was already in C++98, but it seems we never implemented
it, and nobody reported it until 2019.
This patch sets DECL_IMPLICIT_INSTANTIATION to signal to
check_explicit_specialization that we want to find a template, like
grokfndecl already did for explicit template args. check_classfn also needs
to call it, as check_classfn is called after the call to
check_explicit_specialization in grokfndecl, whereas the call to
set_decl_namespace comes sooner. This inconsistency is inelegant, but safer
at this point in the release cycle; I'll unify them in stage 1.
PR c++/91618
PR c++/96604
gcc/cp/ChangeLog:
* name-lookup.cc (set_decl_namespace): Set
DECL_IMPLICIT_INSTANTIATION if no non-template match.
* pt.cc (check_explicit_specialization): Check it.
* decl2.cc (check_classfn): Call it.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/friend7.C: Remove xfail.
* g++.dg/template/friend72.C: New test.
* g++.dg/template/friend72a.C: New test.
* g++.dg/template/friend73.C: New test.
Diffstat (limited to 'gcc/config.gcc')
0 files changed, 0 insertions, 0 deletions