On Tue, Apr 24, 2018 at 12:31 PM, Nathan Sidwell <nat...@acm.org> wrote: > On 04/23/2018 01:19 PM, Jason Merrill wrote: >> >> On Fri, Apr 20, 2018, 12:52 PM Nathan Sidwell <nat...@acm.org > > >> I have to change convert_ptrmem to always >> expand the constant (into an OFFSET_TYPE) so that >> initializer_constant_valid_p (used by reduced_constant_expression_p) >> doesn't get confused by a zero-adjusting conversion of a ptrmem_cst. >> >> >> Hmm, I'm nervous about this change. Maybe teach r_c_e_p to handle this >> case properly? > > > Here's an updated patch. We keep convert_ptrmem unchanged. I didn't need > to teach RCEP anything new, fortunately. In cxx_eval_constant_expression I > call cplus_expand_constant on the cases that we previously complained were > reinterpret_casts. This does seem somewhat ugly though.
Well, in such a static_cast we are no longer referring to a member of the class type, so abandoning the more symbolic PTRMEM_CST seems reasonable. The patch looks good to me. Jason