On Thu, Jan 18, 2018 at 6:13 PM, Jakub Jelinek <ja...@redhat.com> wrote: > Before location wrappers were introduced, the potential_constant_expression_1 > assumption that a VIEW_CONVERT_EXPR must have non-NULL type was right, > if it is a type dependent reinterpret cast, it would be > REINTERPRET_CAST_EXPR instead. > > Location wrappers around decls can have NULL type, if the decl they wrap > also has NULL type.
Hmm, why would a decl have NULL type? Are we wrapping a CONST_DECL in VIEW_CONVERT_EXPR? They should get NON_LVALUE_EXPR, since they aren't lvalues (except the objc++ ones that have TREE_STATIC set). > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk? Alternatively it could if (TREE_TYPE (t) && ... > > On a related note, I wonder if the > return (RECUR (from, TREE_CODE (t) != VIEW_CONVERT_EXPR)); > a few lines below is correct, VCE isn't always an lvalue, only if it is used > in non-rvalue contexts. So, shouldn't it be instead: > return (RECUR (from, (TREE_CODE (t) == VIEW_CONVERT_EXPR > ? want_rval : rval))); A VCE should always be an lvalue. If it's used in an rvalue context, then it's an lvalue used in an rvalue context and so the larger expression is an rvalue, but the VCE is still an lvalue. Jason