mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Auto-cast between enums and the default type.
This commit is contained in:
parent
6b7a81f5a7
commit
e4ac92b5f2
2 changed files with 7 additions and 1 deletions
|
@ -2358,6 +2358,9 @@ cast_expr (type_t *type, expr_t *e)
|
|||
if (type == e_type)
|
||||
return e;
|
||||
|
||||
if ((type == type_default && is_enum (e_type))
|
||||
|| (is_enum (type) && e_type == type_default))
|
||||
return e;
|
||||
if (!(type->type == ev_pointer
|
||||
&& (e_type->type == ev_pointer
|
||||
|| e_type == &type_integer //|| e_type == &type_uinteger
|
||||
|
|
|
@ -498,7 +498,10 @@ static sblock_t *
|
|||
expr_symbol (sblock_t *sblock, expr_t *e, operand_t **op)
|
||||
{
|
||||
*op = new_operand (op_symbol);
|
||||
(*op)->type = e->e.symbol->type->type;
|
||||
if (is_enum (e->e.symbol->type))
|
||||
(*op)->type = type_default->type;
|
||||
else
|
||||
(*op)->type = e->e.symbol->type->type;
|
||||
(*op)->o.symbol = e->e.symbol;
|
||||
return sblock;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue