[qfcc] Handle bitwise not of enums

It looks like I need to handle other unary expressions too, but another
time.
This commit is contained in:
Bill Currie 2020-03-05 01:45:38 +09:00
parent f3236410d0
commit 0bb4279a9f

View file

@ -1407,6 +1407,7 @@ unary_expr (int op, expr_t *e)
quat_t q; quat_t q;
const char *s; const char *s;
expr_t *new; expr_t *new;
type_t *t;
convert_name (e); convert_name (e);
if (e->type == ex_error) if (e->type == ex_error)
@ -1568,6 +1569,11 @@ unary_expr (int op, expr_t *e)
case ev_short: case ev_short:
return new_short_expr (~expr_short (e)); return new_short_expr (~expr_short (e));
case ev_invalid: case ev_invalid:
t = get_type (e);
if (t->meta == ty_enum) {
return new_integer_expr (~expr_integer (e));
}
break;
case ev_type_count: case ev_type_count:
case ev_void: case ev_void:
break; break;