On 01/22/2016 02:37 PM, Andrew MacLeod wrote:

         /* If the initializer is non-void, then it's a normal expression
            that will be assigned to the slot.  */
(*)      if (!VOID_TYPE_P (t))
  (*)         return RECURSE (t);


I suspect this should also be
if (!VOID_TYPE_P(TREE_TYPE(t))

The terminology in the documentation is somewhat unfortunate:

/* For TARGET_EXPR, operand 0 is the target of an initialization,
   operand 1 is the initializer for the target, which may be void
     if simply expanding it initializes the target.
   operand 2 is the cleanup for this node, if any.
   operand 3 is the saved initializer after this node has been
   expanded once; this is so we can re-expand the tree later.  */
DEFTREECODE (TARGET_EXPR, "target_expr", tcc_expression, 4)

I suspect that should read "which may have void type". Code in cp/tree.c also looks at the type of the initializer to see if it is void, so I think you are right with your suspicion.

So, I think your proposed change is OK (modulo formatting), but it may cause problems since it'll enable code that was never tested. Maybe best to do it for gcc-7. Ideally you'd also make a change cleaning up the wording in tree.def.


Bernd

Reply via email to