[Bug c++/122070] [14/15/16 Regression] ICE with type aliases in inherited CTAD since r15-2864

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 18 14:25:14 GMT 2025


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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:a0908b6723128799a68c9fdab65f65761f657488

commit r16-6247-ga0908b6723128799a68c9fdab65f65761f657488
Author: Egas Ribeiro <egas.g.ribeiro@gmail.com>
Date:   Sat Dec 13 13:14:47 2025 +0000

    c++: Fix ICE with type aliases in inherited CTAD [PR122070]

    When processing inherited CTAD in C++23, type_targs_deducible_from can
    be called with a synthetic alias template whose TREE_VALUE is a type
    alias.  Since TYPE_TEMPLATE_INFO_MAYBE_ALIAS can return NULL for type
    aliases, we need to fall back to TYPE_TEMPLATE_INFO to get the template
    info of the underlying type before calling TI_TEMPLATE, which should
    always be non-NULL when called from inherited_ctad_tweaks.

            PR c++/122070

    gcc/cp/ChangeLog:

            * pt.cc (type_targs_deducible_from): Fall back to
            TYPE_TEMPLATE_INFO when TYPE_TEMPLATE_INFO_MAYBE_ALIAS is NULL.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp23/class-deduction-inherited10.C: New test.
            * g++.dg/cpp23/class-deduction-inherited9.C: New test.

    Signed-off-by: Egas Ribeiro <egas.g.ribeiro@gmail.com>
    Co-authored-by: Patrick Palka <ppalka@redhat.com>
    Reviewed-by: Patrick Palka <ppalka@redhat.com>


More information about the Gcc-bugs mailing list