]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Stream DECL_CHAIN for decl_specialization_friend_p functions
authorNathaniel Shead <nathanieloshead@gmail.com>
Mon, 1 Dec 2025 13:43:18 +0000 (00:43 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Mon, 1 Dec 2025 23:12:09 +0000 (10:12 +1100)
commit4247fc98bd910ff8af8bae2aec0dfc256fdde585
tree398537156c546c9377ab850088b6a4a1a1a365f7
parent6a83030557ccceef5c12e8b45d6bcd5ba274232b
c++/modules: Stream DECL_CHAIN for decl_specialization_friend_p functions

r16-5298 attached the owning class for a friend template specialisation
on its DECL_CHAIN.  However we don't stream DECL_CHAIN in general to
avoid walking into unrelated entities on the scope chain; this patch
adds a special case for these functions to ensure we don't lose this
information.

Ideally this would occur in trees_{out,in}::core_vals, but we can't
check decl_specialization_friend_p until after DECL_TEMPLATE_INFO has
been streamed, hence the slightly unusual placement.

gcc/cp/ChangeLog:

* module.cc (trees_out::lang_decl_vals): Stream DECL_CHAIN for
decl_specialization_friend_p functions.
(trees_in::lang_decl_vals): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/modules/friend-12_a.C: New test.
* g++.dg/modules/friend-12_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/friend-12_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/friend-12_b.C [new file with mode: 0644]