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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <[email protected]>:

https://gcc.gnu.org/g:8db7ba7ffbf83c624b572e45c9525ad5740b8f54

commit r16-7901-g8db7ba7ffbf83c624b572e45c9525ad5740b8f54
Author: Marek Polacek <[email protected]>
Date:   Wed Mar 4 17:32:14 2026 -0500

    c++/reflection: fix return value of meta::extent [PR124368]

    std::meta::extent returns a size_t, but eval_extent returns either
    size_zero_node or size_binop(), both of which are of type sizetype,
    which is not the C/C++ size_t and so we don't pass the check in
    cxx_eval_outermost_constant_expr:

      /* Check we are not trying to return the wrong type.  */
      if (!same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (r)))

    We should convert to size_type_node which represents the C/C++ size_t,
    like for instance fold_sizeof_expr does.

            PR c++/124368

    gcc/cp/ChangeLog:

            * reflect.cc (eval_extent): Convert the result to size_type_node.

    gcc/testsuite/ChangeLog:

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

    Reviewed-by: Jakub Jelinek <[email protected]>

Reply via email to