Resurrect the address expression code for arrays etc.

This fixes selector finding.
This commit is contained in:
Bill Currie 2011-02-04 23:20:37 +09:00
parent c542e1a453
commit eff3957487

View file

@ -1863,8 +1863,24 @@ address_expr (expr_t *e1, expr_t *e2, type_t *t)
switch (e1->type) {
case ex_symbol:
if (e1->e.symbol->sy_type == sy_var) {
e = new_unary_expr ('&', e1);
e->e.expr.type = pointer_type (t);
def_t *def = e1->e.symbol->s.def;
type_t *type = def->type;
if (is_struct (type) || is_class (type)) {
e = new_pointer_expr (0, t, def);
e->line = e1->line;
e->file = e1->file;
} else if (is_array (type)) {
e = e1;
e->type = ex_value;
e->e.value.type = ev_pointer;
e->e.value.v.pointer.val = 0;
e->e.value.v.pointer.type = t;
e->e.value.v.pointer.def = def;
} else {
e = new_unary_expr ('&', e1);
e->e.expr.type = pointer_type (t);
}
break;
}
return error (e1, "invalid type for unary &");