https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113814
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathaniel Shead <nsh...@gcc.gnu.org>: https://gcc.gnu.org/g:815e48e3d42231b675bae1dec5fa26890f048ef1 commit r15-4862-g815e48e3d42231b675bae1dec5fa26890f048ef1 Author: Nathaniel Shead <nathanielosh...@gmail.com> Date: Thu Oct 31 20:05:16 2024 +1100 c++/modules: Propagate TYPE_CANONICAL for partial specialisations [PR113814] In some cases, when we go to import a partial specialisation there might already be an incomplete implicit instantiation in the specialisation table. This causes ICEs described in the linked PR as we now have two separate matching specialisations for this same arguments with different TYPE_CANONICAL. We already support multiple specialisations with the same args however, as they may be differently constrained. So we can solve this by simply ensuring that the TYPE_CANONICAL of the new partial specialisation matches the existing specialisation. PR c++/113814 gcc/cp/ChangeLog: * pt.cc (add_mergeable_specialization): Propagate TYPE_CANONICAL. gcc/testsuite/ChangeLog: * g++.dg/modules/partial-6.h: New test. * g++.dg/modules/partial-6_a.H: New test. * g++.dg/modules/partial-6_b.H: New test. * g++.dg/modules/partial-6_c.C: New test. Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com> Co-authored-by: Jason Merrill <ja...@redhat.com>