Support entity.field = structvar2 = structvar1;

The structvar2 = structvar1 is implemented as a move expresion, which
address_expr didn't like. Return the address of the source. For indirect
move expressions, this is just the source expression itself.
This commit is contained in:
Bill Currie 2012-11-20 17:12:16 +09:00
parent 5cfeb7809f
commit 984aa9a4cf

View file

@ -2189,6 +2189,16 @@ address_expr (expr_t *e1, expr_t *e2, type_t *t)
e->e.expr.type = pointer_type (e->e.expr.type);
break;
}
if (e1->e.expr.op == 'm') {
// direct move, so obtain the address of the source
e = address_expr (e1->e.expr.e2, 0, t);
break;
}
if (e1->e.expr.op == 'M') {
// indirect move, so we already have the address of the source
e = e1->e.expr.e2;
break;
}
return error (e1, "invalid type for unary &");
case ex_uexpr:
if (e1->e.expr.op == '.') {