On Fri, Apr 20, 2018 at 02:52:32PM -0400, Nathan Sidwell wrote: > On 04/20/2018 01:44 PM, Jason Merrill wrote: > > > Any time we need an actual adjustment, there will be a PLUS_EXPR. The > > issue is somehow distinguishing between a reinterpret_cast and one of > > the many other sources of NOP_EXPR. > > yeah, I see that now. Perhaps VIEW_CONVERT_EXPR is more appropriate for the
Thanks for taking this over. > * cp-tree.h (REINTERPRETT_CAST_P): New. s/TT/T/ > +/* Build a NOP_EXPR to TYPE, but mark it as a reinterpret_cast so that > + constexpr evaluation knows to reject it. */ > + > +static tree > +build_nop_reinterpret (tree type, tree expr) > +{ > + expr = build_nop (type, expr); > + REINTERPRET_CAST_P (expr) = true; > + return expr; build_nop can return the expr passed to it if it is error_operand or type is error_mark_node. Shouldn't this e.g. check if build_nop returned something other than expr before setting the flag on it? tree ret = build_nop (type, expr); if (ret != expr) REINTERPRET_CAST_P (ret) = true; return ret; ? Jakub