Skip to content
Snippets Groups Projects
Commit c310d29c authored by Nathaniel Shead's avatar Nathaniel Shead
Browse files

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: default avatarNathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: default avatarJason Merrill <jason@redhat.com>
parent 80fda0ad
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment