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 <[email protected]>:

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

commit r16-6247-ga0908b6723128799a68c9fdab65f65761f657488
Author: Egas Ribeiro <[email protected]>
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 <[email protected]>
    Co-authored-by: Patrick Palka <[email protected]>
    Reviewed-by: Patrick Palka <[email protected]>

Reply via email to