https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120161

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Patrick Palka
<ppa...@gcc.gnu.org>:

https://gcc.gnu.org/g:488c997aeb6669c333287a1f0063ce5fb706a8b5

commit r15-9690-g488c997aeb6669c333287a1f0063ce5fb706a8b5
Author: Patrick Palka <ppa...@redhat.com>
Date:   Thu May 15 11:07:53 2025 -0400

    c++: unifying specializations of non-primary tmpls [PR120161]

    Here unification of P=Wrap<int>::type, A=Wrap<long>::type wrongly
    succeeds ever since r14-4112 which made the RECORD_TYPE case of unify
    no longer recurse into template arguments for non-primary templates
    (since they're a non-deduced context) and so the int/long mismatch that
    makes the two types distinct goes unnoticed.

    In the case of (comparing specializations of) a non-primary template,
    unify should still go on to compare the types directly before returning
    success.

            PR c++/120161

    gcc/cp/ChangeLog:

            * pt.cc (unify) <case RECORD_TYPE>: When comparing specializations
            of a non-primary template, still perform a type comparison.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/unify13.C: New test.

    Reviewed-by: Jason Merrill <ja...@redhat.com>
    (cherry picked from commit 0c430503f2849ebb20105695b8ad40d43d797c7b)

Reply via email to