summaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
Diffstat (limited to 'types.c')
-rw-r--r--types.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/types.c b/types.c
index 0ec2a26..712c8d8 100644
--- a/types.c
+++ b/types.c
@@ -2604,14 +2604,14 @@ static Status types_expr(Typer *tr, Expression *e) {
case UNARY_DSIZEOF:
case UNARY_DALIGNOF: {
Type *queried_type;
- if (type_is_builtin(&of->type, BUILTIN_TYPE)) {
- Value val;
- if (!eval_expr(tr->evalr, of, &val))
- return false;
- queried_type = val.type;
- } else {
- queried_type = &of->type;
+ if (!type_is_builtin(&of->type, BUILTIN_TYPE)) {
+ err_print(e->where, "Argument of #sizeof or #alignof must be a Type. Did you mean #sizeof(typeof ...)?");
+ return false;
}
+ Value val;
+ if (!eval_expr(tr->evalr, of, &val))
+ return false;
+ queried_type = val.type;
if (e->unary.op == UNARY_DSIZEOF)
e->val.i64 = (I64)compiler_sizeof(queried_type);
else