diff --git a/tccgen.c b/tccgen.c index a573e6b8..7fa7e932 100644 --- a/tccgen.c +++ b/tccgen.c @@ -3916,6 +3916,7 @@ do_decl: get_tok_str(v, NULL)); } if ((type1.t & VT_BTYPE) == VT_FUNC || + (type1.t & VT_BTYPE) == VT_VOID || (type1.t & VT_STORAGE)) tcc_error("invalid type for '%s'", get_tok_str(v, NULL)); @@ -7362,6 +7363,9 @@ found: } sym->a = ad.a; sym->f = ad.f; + } else if ((type.t & VT_BTYPE) == VT_VOID + && !(type.t & VT_EXTERN)) { + tcc_error("declaration of void object"); } else { r = 0; if ((type.t & VT_BTYPE) == VT_FUNC) {