detect multiple initializations of globals

This commit is contained in:
Bill Currie 2003-01-29 22:29:37 +00:00
parent 8a9cd78072
commit 2d766710b6

View file

@ -409,10 +409,14 @@ var_initializer
def_initialized ($<def>0);
} else {
if ($2->type >= ex_string) {
if ($<def>0->type->type == ev_func) {
PARSE_ERROR;
if ($<def>0->constant) {
error ($2, "%s re-initialized", $<def>0->name);
} else {
ReuseConstant ($2, $<def>0);
if ($<def>0->type->type == ev_func) {
PARSE_ERROR;
} else {
ReuseConstant ($2, $<def>0);
}
}
} else {
error ($2, "non-constant expression used for initializer");