]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Fix exporting temploid friends in header units [PR118582]
authorNathaniel Shead <nathanieloshead@gmail.com>
Wed, 22 Jan 2025 10:24:03 +0000 (21:24 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Thu, 23 Jan 2025 06:37:43 +0000 (17:37 +1100)
commit21cccfa91e6ed172062e0c62682422269c914937
treeb9777e1b01437cde1d5623246a72f2ce60c1e0a4
parent9ddf4a6cc650360e620c8fd97f550bf833cc177a
c++/modules: Fix exporting temploid friends in header units [PR118582]

When we started streaming the bit to handle merging of imported temploid
friends in r15-2807, I unthinkingly only streamed it in the
'!state->is_header ()' case.

This patch reworks the streaming logic to ensure that this data is
always streamed, including for unique entities (in case that ever comes
up somehow).  This does make the streaming slightly less efficient, as
functions and types will need an extra byte, but this doesn't appear to
make a huge difference to the size of the resulting module; the 'std'
module on my machine grows by 0.2% from 30671136 to 30730144 bytes.

PR c++/118582

gcc/cp/ChangeLog:

* module.cc (trees_out::decl_value): Always stream
imported_temploid_friends information.
(trees_in::decl_value): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr118582_a.H: New test.
* g++.dg/modules/pr118582_b.H: New test.
* g++.dg/modules/pr118582_c.H: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/pr118582_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr118582_b.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr118582_c.H [new file with mode: 0644]