aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/codegen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.c b/src/codegen.c
index be8acd7..e0e0b19 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -148,6 +148,10 @@ static void codegen_deref_expr(CodeGen* g, AstNode* ast, GenMode gen_mode) {
static void codegen_cast_expr(CodeGen* g, AstNode* ast) {
codegen_expr(g, ast->node_operand, GenMode_rval);
+ // (void) cast does nothing.
+ if (ast->ty->kind == TypeKind_void)
+ return;
+
int src_size = type_sizeof(ast->node_operand->ty);
int dst_size = type_sizeof(ast->ty);