-
- Downloads
c++/modules: Fix type lookup in DECL_TEMPLATE_INSTANTIATIONS [PR116364]
We need to use the DECL_TEMPLATE_INSTANTIATIONS property to find reachable specialisations from a template to ensure that any GM specialisations are properly marked as reachable. Currently the modules code uses the decl when rebuilding this property, but this is not always correct; it appears that for type specialisations we need to use the TREE_TYPE of the decl instead so that the specialisation is correctly found. This patch makes the required adjustments. PR c++/116364 gcc/cp/ChangeLog: * cp-tree.h (get_mergeable_specialization_flags): Adjust signature. * module.cc (trees_out::decl_value): Indicate whether this is a type or decl specialisation. * pt.cc (get_mergeable_specialization_flags): Match against the type of a non-decl specialisation. (add_mergeable_specialization): Use the already calculated spec instead of always adding decl to DECL_TEMPLATE_INSTANTIATIONS. gcc/testsuite/ChangeLog: * g++.dg/modules/tpl-spec-9_a.C: New test. * g++.dg/modules/tpl-spec-9_b.C: New test. * g++.dg/modules/tpl-spec-9_c.C: New test. Signed-off-by:Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by:
Jason Merrill <jason@redhat.com>
Showing
- gcc/cp/cp-tree.h 2 additions, 1 deletiongcc/cp/cp-tree.h
- gcc/cp/module.cc 2 additions, 1 deletiongcc/cp/module.cc
- gcc/cp/pt.cc 5 additions, 3 deletionsgcc/cp/pt.cc
- gcc/testsuite/g++.dg/modules/tpl-spec-9_a.C 12 additions, 0 deletionsgcc/testsuite/g++.dg/modules/tpl-spec-9_a.C
- gcc/testsuite/g++.dg/modules/tpl-spec-9_b.C 5 additions, 0 deletionsgcc/testsuite/g++.dg/modules/tpl-spec-9_b.C
- gcc/testsuite/g++.dg/modules/tpl-spec-9_c.C 5 additions, 0 deletionsgcc/testsuite/g++.dg/modules/tpl-spec-9_c.C
Loading
Please register or sign in to comment