RFA: PATCH to initializer_constant_valid_p for c++/38880

Jason Merrill jason@redhat.com
Thu Feb 19 01:36:00 GMT 2009


Fixing this bug in either fold or the front end had the same problem of 
making the pseudo-offsetof expression look like a valid C++ 
constant-expression, when it should not be.  We just want it to be 
accepted by initializer_constant_valid_p.  As it turns out, we just need 
to make the existing code accept PLUS_EXPR as well as POINTER_PLUS_EXPR, 
now that we no longer fold the former into the latter in this case.

Ian, was there any particular reason for limiting narrowing support to 
POINTER_PLUS_EXPR and MINUS_EXPR, but not PLUS_EXPR?  The testcase was 
failing because we fold the MINUS_EXPR to a PLUS_EXPR with the second 
operand negated.

Tested x86_64-pc-linux-gnu.

OK for trunk?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 38880.patch
Type: text/x-patch
Size: 1610 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090219/0b63a546/attachment.bin>


More information about the Gcc-patches mailing list