]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: befriending template from current class scope
authorPatrick Palka <ppalka@redhat.com>
Wed, 6 Mar 2024 01:36:36 +0000 (20:36 -0500)
committerPatrick Palka <ppalka@redhat.com>
Wed, 6 Mar 2024 01:36:36 +0000 (20:36 -0500)
commitb0d11bb02a4a4c7d61e9b53411ccdc54610b1429
tree3fa60882824d5d59a8597b9354ecaa8ea3f2cb48
parent214dadf30a3bab0d02b8c6512a2d0475e2643dc7
c++/modules: befriending template from current class scope

Here the TEMPLATE_DECL representing the template friend declaration
naming B has class scope since the template B has class scope, but
get_merge_kind assumes all DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P
TEMPLATE_DECL have namespace scope and wrongly returns MK_named instead
of MK_local_friend for the friend.

gcc/cp/ChangeLog:

* module.cc (trees_out::get_merge_kind) <case depset::EK_DECL>:
Accomodate class-scope DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P
TEMPLATE_DECL.  Consolidate IDENTIFIER_ANON_P cases.

gcc/testsuite/ChangeLog:

* g++.dg/modules/friend-7.h: New test.
* g++.dg/modules/friend-7_a.H: New test.
* g++.dg/modules/friend-7_b.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/friend-7.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/friend-7_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/friend-7_b.C [new file with mode: 0644]