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

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

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

commit r17-382-ge8aa21caed8a3c8b4b27d224a04296f008bcf3da
Author: Jakub Jelinek <[email protected]>
Date:   Thu May 7 17:31:09 2026 +0200

    c++: Improve REFLECT_EXPR printing [PR125007]

    The following patch fixes REFLECT_EXPR printing.  Currently it prints
everything
    as ^^ followed by dumping the decl/type/expr handle of the
REFLECT_EXPR_HANDLE
    except the weird printing of data member specifications.
    E.g. annotations are printed as ^^ and dump_expr on the
REFLECT_EXPR_HANDLE,
    which is a TREE_LIST so it prints the TREE_VALUE of TREE_VALUE of that in
    the end and prints e.g. reflection of [[=1]] as ^^1.
    The following patch prints reflections of annotations as ^^[[=1]] which is
    also not valid C++ syntax, but because the IL doesn't store the decl/type
    etc. in whose DECL_ATTRIBUTES/TYPE_ATTRIBUTES it appears, I'm afraid we
    can't do much better (like print annotations_of(^^something)[N]).
    For
REFLECT_BASE/REFLECT_PARM/REFLECT_DATA_MEMBER_SPEC/REFLECT_VALUE/REFLECT_OBJECT,
    it attempts to use the C++ valid syntax, so prints
    bases_of(^^type,std::meta::access_context::unchecked())[N] {aka base_type}
    parameters_of(^^decl)[N] {aka param_name}
    data_member_spec(^^type,{.name="foo"})
    std::meta::reflect_constant(X)
    std::meta::reflect_object(X)
    etc.

    2026-05-07  Jakub Jelinek  <[email protected]>

            PR c++/125007
            * cp-tree.h (maybe_update_function_parm): Declare.
            * reflect.cc (maybe_update_function_parm): No longer static.
            * error.cc (dump_expr) <case REFLECT_EXPR>: Improve printing
            of various reflections.

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

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to