On Wed, Oct 03, 2012 at 11:14:37AM +0200, Dodji Seketeli wrote: > Jakub Jelinek <ja...@redhat.com> a écrit: > > > --- gcc/cp/call.c.jj 2012-09-27 12:45:49.000000000 +0200 > > +++ gcc/cp/call.c 2012-10-01 17:53:17.594609236 +0200 > > @@ -557,7 +557,10 @@ null_ptr_cst_p (tree t) > > { > > /* Core issue 903 says only literal 0 is a null pointer constant. */ > > if (cxx_dialect < cxx0x) > > - t = integral_constant_value (t); > > + { > > + t = integral_constant_value (t); > > + t = maybe_constant_value (t); > > + } > > Just for my education, why couldn't maybe_constant_value just call > integral_constant_value, so that we just use maybe_constant_value here?
Perhaps maybe_constant_value already does all that integral_constant_value does, but I'm not sure about it. maybe_constant_value starts with a lot of conditions where it doesn't do anything if they are true, integral_constant_value doesn't have any such conditions, on the other side performs far less - just loops through DECL_INITIAL values looking for a const. As I said earlier, while the initial hacks around early folding of SIZEOF_EXPR were quite ugly, the amount of changes to allow late folding of SIZEOF_EXPR was huge, with user visible changes etc. Jakub