Issue error on "void" typed variable, function parameter, or struct member.

This commit is contained in:
Matt Pharr
2012-02-06 07:44:45 -08:00
parent fa7a7fe23e
commit 977b983771
10 changed files with 56 additions and 1 deletions

View File

@@ -237,6 +237,11 @@ Module::AddGlobalVariable(Symbol *sym, Expr *initExpr, bool isConst) {
return;
}
if (sym->type == AtomicType::Void) {
Error(sym->pos, "\"void\" type global variable is illegal.");
return;
}
sym->type = ArrayType::SizeUnsizedArrays(sym->type, initExpr);
if (sym->type == NULL)
return;