mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
allow casting between function types
This commit is contained in:
parent
cbd2c42178
commit
627c6f70f5
3 changed files with 8 additions and 5 deletions
|
@ -522,8 +522,10 @@ emit_sub_expr (expr_t *e, def_t *dest)
|
|||
return emit_deref_expr (e, dest);
|
||||
case 'C':
|
||||
def_a = emit_sub_expr (e->e.expr.e1, 0);
|
||||
if (def_a->type->type == ev_pointer
|
||||
&& e->e.expr.type->type == ev_pointer) {
|
||||
if ((def_a->type->type == ev_pointer
|
||||
&& e->e.expr.type->type == ev_pointer)
|
||||
|| (def_a->type->type == ev_func
|
||||
&& e->e.expr.type->type == ev_func)) {
|
||||
return def_a;
|
||||
}
|
||||
def_b = &def_void;
|
||||
|
|
|
@ -2302,6 +2302,7 @@ cast_expr (type_t *type, expr_t *e)
|
|||
e_type = get_type (e);
|
||||
|
||||
if (!(type->type == ev_pointer && e_type->type == ev_pointer)
|
||||
&& !(type->type == ev_func && e_type->type == ev_func)
|
||||
&& !(((type == &type_integer || type == &type_uinteger)
|
||||
&& e_type == &type_float)
|
||||
|| (type == &type_float
|
||||
|
|
|
@ -174,7 +174,7 @@ expr_t *argv_expr (void);
|
|||
%type <methodlist> methodprotolist methodprotolist2
|
||||
%type <type> ivar_decl_list
|
||||
|
||||
%expect 3
|
||||
%expect 4
|
||||
|
||||
%{
|
||||
|
||||
|
@ -816,7 +816,7 @@ unary_expr
|
|||
| '~' cast_expr %prec UNARY { $$ = unary_expr ('~', $2); }
|
||||
| '&' cast_expr %prec UNARY { $$ = address_expr ($2, 0, 0); }
|
||||
| SIZEOF unary_expr %prec UNARY { $$ = sizeof_expr ($2, 0); }
|
||||
| SIZEOF '(' non_field_type ')' %prec HYPERUNARY { $$ = sizeof_expr (0, $3); }
|
||||
| SIZEOF '(' type ')' %prec HYPERUNARY { $$ = sizeof_expr (0, $3); }
|
||||
;
|
||||
|
||||
primary
|
||||
|
@ -838,7 +838,7 @@ primary
|
|||
|
||||
cast_expr
|
||||
: unary_expr
|
||||
| '(' non_field_type ')' cast_expr %prec UNARY { $$ = cast_expr ($2, $4); }
|
||||
| '(' type ')' cast_expr %prec UNARY { $$ = cast_expr ($2, $4); }
|
||||
;
|
||||
|
||||
expr
|
||||
|
|
Loading…
Reference in a new issue