[Bug c++/124177] [reflection] annotation denoting function rejected

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 8 15:14:36 GMT 2026


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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

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

commit r16-8534-gcf63e47257ade5ec921fd090b6b925322f7a9ebf
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Mar 18 17:51:35 2026 -0400

    c++/reflection: allow fns/arrays as annotation values [PR124177]

    With an annotation like [[=func]] gcc ends up calling
    handle_annotation_attribute with TREE_VALUE (args) being
    a VIEW_CONVERT_EXPR, whose type is a FUNCTION_TYPE.  That kind of
    annotation value should be decayed before checking if the type is
    structural.

            PR c++/124177

    gcc/cp/ChangeLog:

            * tree.cc (handle_annotation_attribute): Decay annotation
            values.  Turn if !type_dependent_expression_p into an assert.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/annotations18.C: New test.

    Co-authored-by: Boris Staletic <boris.staletic@protonmail.com>
    Reviewed-by: Jason Merrill <jason@redhat.com>


More information about the Gcc-bugs mailing list