]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Propagate TYPE_CANONICAL for partial specialisations [PR113814]
authorNathaniel Shead <nathanieloshead@gmail.com>
Thu, 31 Oct 2024 09:05:16 +0000 (20:05 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Sat, 2 Nov 2024 11:16:30 +0000 (22:16 +1100)
commit815e48e3d42231b675bae1dec5fa26890f048ef1
tree01e458c5a34330f09271ef67f14410ac0266237d
parent4a99443c5dd9a235022652ba0fb143c6370ea99d
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 <nathanieloshead@gmail.com>
Co-authored-by: Jason Merrill <jason@redhat.com>
gcc/cp/pt.cc
gcc/testsuite/g++.dg/modules/partial-6.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/partial-6_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/partial-6_b.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/partial-6_c.C [new file with mode: 0644]