mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
allow assignment of arrays to poitners
This commit is contained in:
parent
e9f49ca816
commit
904197c70e
3 changed files with 12 additions and 1 deletions
|
@ -2477,7 +2477,8 @@ cast_expr (type_t *type, expr_t *e)
|
|||
|
||||
if (!(type->type == ev_pointer
|
||||
&& (e_type->type == ev_pointer
|
||||
|| e_type == &type_integer || e_type == &type_uinteger))
|
||||
|| e_type == &type_integer || e_type == &type_uinteger
|
||||
|| e_type->type == ev_array))
|
||||
&& !(type->type == ev_func && e_type->type == ev_func)
|
||||
&& !(((type == &type_integer || type == &type_uinteger)
|
||||
&& (e_type == &type_float || e_type == &type_integer
|
||||
|
@ -2488,6 +2489,9 @@ cast_expr (type_t *type, expr_t *e)
|
|||
pr_type_name[extract_type (e)],
|
||||
pr_type_name[type->type]);
|
||||
}
|
||||
if (e_type ->type == ev_array) {
|
||||
return address_expr (e, 0, 0);
|
||||
}
|
||||
if (e->type == ex_uexpr && e->e.expr.op == '.') {
|
||||
e->e.expr.type = type;
|
||||
c = e;
|
||||
|
|
|
@ -528,6 +528,8 @@ method_check_params (method_t *method, expr_t *args)
|
|||
if (i < parm_count) {
|
||||
if (e->type != ex_nil)
|
||||
if (!type_assignable (mtype->parm_types[i], t)) {
|
||||
print_type (mtype->parm_types[i]); puts ("");
|
||||
print_type (t); puts ("");
|
||||
err = error (e, "type mismatch for parameter %d of %s",
|
||||
i - 1, method->name);
|
||||
}
|
||||
|
|
|
@ -565,6 +565,11 @@ type_assignable (type_t *dst, type_t *src)
|
|||
|
||||
if (dst == src)
|
||||
return 1;
|
||||
if (dst->type == ev_pointer && src->type == ev_array) {
|
||||
if (dst->aux_type == src->aux_type)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
if (dst->type != ev_pointer || src->type != ev_pointer)
|
||||
return is_scalar (dst) && is_scalar (src);
|
||||
dst = dst->aux_type;
|
||||
|
|
Loading…
Reference in a new issue