[Bug c++/126093] (reflection) ICE in write_unqualified_name, at cp/mangle.cc:1570

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126093

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Jakub Jelinek
<[email protected]>:

https://gcc.gnu.org/g:9960824ebdee198f3dfff5545b630f5ab3c5ebfa

commit r16-9550-g9960824ebdee198f3dfff5545b630f5ab3c5ebfa
Author: Jakub Jelinek <[email protected]>
Date:   Tue Aug 18 17:49:11 2026 +0200

    c++: Fix ICE during mangling of a conversion operator function template
[PR126093]

    On Tue, Aug 11, 2026 at 04:25:19PM -0400, Jason Merrill wrote:
    > On 8/7/26 8:45 AM, Jakub Jelinek wrote:
    > > We ICE when trying to mangle the TEMPLATE_DECL of a conversion
operator,
    > > because FNDECL_USED_AUTO macro requires FUNCTION_DECL, but here we
    > > have a TEMPLATE_DECL instead.
    > > In this case, DECL_CONV_FN_TYPE contains the right type, so this patch
    > > just guards the FNDECL_USED_AUTO macro use on FUNCTION_DECLs.
    >
    > Hmm, if it's valid to get a TEMPLATE_DECL here I think we want to
    > STRIP_TEMPLATE earlier in the function to avoid the need for this; lots
of
    > other things here seem to assume we're looking at the inner decl.

    Ok, here is a different patch then to use STRIP_TEMPLATE before calling
    write_unqualified_name in the {class,function,variable,alias} template,
    concept, namespace alias and namespace (for the last two STRIP_TEMPLATE
    will do nothing, so I haven't moved it to a separate handling).

    2026-08-17  Jakub Jelinek  <[email protected]>

            PR c++/126093
            * mangle.cc (write_reflection): Call write_unqualified_name on
            STRIP_TEMPLATE (arg) rather than just arg.

            * g++.dg/reflect/mangle1.C: Add 2 new tests for reflections of
            conversion templates.

    Reviewed-by: Jason Merrill <[email protected]>
    (cherry picked from commit 91e2f5a8aac9c9825e4a13e8f7451bc6d8f75790)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.