c++: Don't emit unused GMF partial specializations [PR114630]
commit02917ac4528e32d1b2d0da5f45ef5937c56942cd
authorNathaniel Shead <nathanieloshead@gmail.com>
Thu, 11 Apr 2024 09:15:35 +0000 (11 19:15 +1000)
committerNathaniel Shead <nathanieloshead@gmail.com>
Thu, 2 May 2024 06:42:56 +0000 (2 16:42 +1000)
tree74b157618851c1e89e980e448ed7449c9028d3ca
parent6c4a745c6910659a75d1881cf3c4128f24b5666f
c++: Don't emit unused GMF partial specializations [PR114630]

The change in r14-8408 to also emit partial specializations in the
global module fragment caused the regression in the linked PR; this
patch fixes this by restricting emitted GM partial specializations to
those that are actually used.

PR c++/114630

gcc/cp/ChangeLog:

* module.cc (depset::hash::add_partial_entities): Mark GM
specializations as unreached.
(depset::hash::find_dependencies): Also reach entities in the
DECL_TEMPLATE_SPECIALIZATIONS list.

gcc/testsuite/ChangeLog:

* g++.dg/modules/partial-3.C: New test.

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