On Wed, Jan 15, 2025 at 04:48:59PM -0500, Jason Merrill wrote:
> > --- a/gcc/cp/decl.cc
> > +++ b/gcc/cp/decl.cc
> > @@ -11686,6 +11686,7 @@ fold_sizeof_expr (tree t)
> >                                 false, false);
> >     if (r == error_mark_node)
> >       r = size_one_node;
> > +  r = cp_fold_convert (TREE_TYPE (t), r);
> 
> Instead of adding this conversion in all cases, let's change size_one_node
> to
> 
> build_int_cst (size_type_node, 1)

That would need to be r = build_int_cst (TREE_TYPE (t), 1);
I guess, while that is maybe fine, I don't see how it could avoid
the cp_fold_convert call, because size_one_node can be returned
also from e.g. c-family c_sizeof_or_alignof_type or its typeck.cc callers,
or it can be size_int (something) etc.

        Jakub

Reply via email to