diff options
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 23 |
1 files changed, 4 insertions, 19 deletions
@@ -1366,25 +1366,6 @@ static bool eval_expr(Evaluator *ev, Expression *e, Value *v) { case EXPR_C: err_print(e->where, "Cannot run C code at compile time."); return false; - case EXPR_DSIZEOF: - case EXPR_DALIGNOF: { - Expression *of = e->kind == EXPR_DSIZEOF ? e->dsizeof.of : e->dalignof.of; - Type *type; - if (of->type.kind == TYPE_TYPE) { - /* it's a type, return the size/align of it */ - Value typeval; - if (!eval_expr(ev, of, &typeval)) return false; - type = typeval.type; - if (!type_resolve(ev->typer, type, e->where)) return false; - } else { - /* it's an expression, return the size/align of its type */ - type = &of->type; - } - if (e->kind == EXPR_DSIZEOF) - v->i64 = (I64)compiler_sizeof(type); - else - v->i64 = (I64)compiler_alignof(type); - } break; case EXPR_NEW: /* it's not strictly necessary to do the if here */ if (e->new.n) { @@ -1542,6 +1523,10 @@ static bool eval_expr(Evaluator *ev, Expression *e, Value *v) { case EXPR_VAL: *v = e->val; break; + case EXPR_DSIZEOF: + case EXPR_DALIGNOF: + assert(0); + return false; } return true; } |