On Wed, Mar 04, 2026 at 05:54:22PM -0500, Marek Polacek wrote:
> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
> 
> -- >8 --
> 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.

LGTM.  Checked all other metafns returning size_t and they are fine,
either they fold_convert (ret_type, ...) or eval_tuple_size/variant_size just
instantiates a template, or eval_rank just calls build_int_cst
(size_type_node, ...).

        Jakub

Reply via email to