On Thu, Dec 19, 2019 at 12:40:12AM +0100, Jakub Jelinek wrote: > Hi! > > While looking at PR92666, I've spotted a wrong-code issue where we ignore > any side-effects on arguments passed to ellipsis if they have > decltype(nullptr) type. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk and release branches?
Looks fine to me, and reminds me of c++/90473. > 2019-12-19 Jakub Jelinek <ja...@redhat.com> > > PR c++/92992 > * call.c (convert_arg_to_ellipsis): For decltype(nullptr) arguments > that have side-effects use cp_build_compound_expr. > > * g++.dg/cpp0x/nullptr45.C: New test. > > --- gcc/cp/call.c.jj 2019-12-17 10:19:51.013282361 +0100 > +++ gcc/cp/call.c 2019-12-18 18:23:01.441357443 +0100 > @@ -7822,7 +7822,12 @@ convert_arg_to_ellipsis (tree arg, tsubs > arg = convert_to_real_nofold (double_type_node, arg); > } > else if (NULLPTR_TYPE_P (arg_type)) > - arg = null_pointer_node; > + { > + if (TREE_SIDE_EFFECTS (arg)) > + arg = cp_build_compound_expr (arg, null_pointer_node, complain); > + else > + arg = null_pointer_node; > + } FWIW, I was wondering if this should be nullptr_node instead but http://eel.is/c++draft/expr.call#12.sentence-5 says "An argument that has type cv std::nullptr_t is converted to type void*." Perhaps there should be a comment to that effect... -- Marek Polacek • Red Hat, Inc. • 300 A St, Boston, MA