On Tue, Jan 09, 2024 at 11:20:02AM +0300, Dmitry Drozodv wrote: > diff --git a/gcc/cp/cvt.cc b/gcc/cp/cvt.cc > index cbed847b343..14462356a0e 100644 > --- a/gcc/cp/cvt.cc > +++ b/gcc/cp/cvt.cc > @@ -218,8 +218,9 @@ cp_convert_to_pointer (tree type, tree expr, bool > dofold, > ? build_int_cst_type (type, -1) > : build_int_cst (type, 0)); > > - return (TREE_SIDE_EFFECTS (expr) > - ? build2 (COMPOUND_EXPR, type, expr, val) : val); > + /* C++ [conv.lval]p3.1: > + If T is cv std::nullptr_t, the result is a null pointer constant. > */ > + return val; > } > else if (TYPE_PTRMEM_P (type) && INTEGRAL_CODE_P (form))
This looks incorrect. You can't throw all side-effects away. Consider expr being say a function call which returns std::nullptr_t, the function still has to be called, not ignored. Jakub