diff --git a/tccgen.c b/tccgen.c index dc67f028..3cf37155 100644 --- a/tccgen.c +++ b/tccgen.c @@ -2258,6 +2258,8 @@ static void gen_assign_cast(CType *dt) st = &vtop->type; /* source type */ dbt = dt->t & VT_BTYPE; sbt = st->t & VT_BTYPE; + if (sbt == VT_VOID) + tcc_error("Cannot assign void value"); if (dt->t & VT_CONSTANT) tcc_warning("assignment of read-only location"); switch(dbt) {