fix: check if parsing a variable initializer failed

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-08-23 13:30:30 +02:00
parent fe2f9d79c5
commit 5022f716dc

View file

@ -2509,6 +2509,11 @@ nextvar:
ast_value *cval;
cexp = parser_expression_leave(parser, true);
if (!cexp) {
ast_value_delete(typevar);
return false;
}
cval = (ast_value*)cexp;
if (!ast_istype(cval, ast_value) || !cval->isconst)
parseerror(parser, "cannot initialize a global constant variable with a non-constant expression");