diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2025-05-17 23:51:07 +1000 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2025-05-20 12:11:31 +1000 |
commit | 2d1244a5b2dca62b97656cdfa28cd99af583aaa8 (patch) | |
tree | cc6c870d54fefdd4f5ba92a8223032c110693fed /gcc/coverage.c | |
parent | 3ba1b0ac7ccbe7b01811302dc1d50dcdbd7dc2ac (diff) | |
download | gcc-2d1244a5b2dca62b97656cdfa28cd99af583aaa8.zip gcc-2d1244a5b2dca62b97656cdfa28cd99af583aaa8.tar.gz gcc-2d1244a5b2dca62b97656cdfa28cd99af583aaa8.tar.bz2 |
c++/modules: Fix ICE on merge of instantiation with partial spec [PR120013]
When we import a pending instantiation that matches an existing partial
specialisation, we don't find the slot in the entity map because for
partial specialisations we register the TEMPLATE_DECL but for normal
implicit instantiations we instead register the inner TYPE_DECL.
Because the DECL_MODULE_ENTITY_P flag is set we correctly realise that
it is in the entity map, but ICE when attempting to use that slot in
partition handling.
This patch fixes the issue by detecting this case and instead looking
for the slot for the TEMPLATE_DECL. It doesn't matter that we never add
a slot for the inner decl because we're about to discard it anyway.
PR c++/120013
gcc/cp/ChangeLog:
* module.cc (trees_in::install_entity): Handle re-registering
the inner TYPE_DECL of a partial specialisation.
gcc/testsuite/ChangeLog:
* g++.dg/modules/partial-8.h: New test.
* g++.dg/modules/partial-8_a.C: New test.
* g++.dg/modules/partial-8_b.C: New test.
* g++.dg/modules/partial-8_c.C: New test.
* g++.dg/modules/partial-8_d.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit b0de7297f2b5670386472229ab795a577c288ecf)
Diffstat (limited to 'gcc/coverage.c')
0 files changed, 0 insertions, 0 deletions