diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 053f3ef43..77d98e792 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -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 diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 1cabb3762..6f8bd84e1 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -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; }