mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-21 07:30:53 +00:00
more on CV_CONST/CV_VAR, initializers to check 'constant' not just 'hasvalue'
This commit is contained in:
parent
6cd432a909
commit
1b72cb264a
1 changed files with 3 additions and 3 deletions
6
parser.c
6
parser.c
|
@ -3505,7 +3505,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
|
|||
}
|
||||
}
|
||||
|
||||
if (is_const_var > 0)
|
||||
if (is_const_var == CV_CONST)
|
||||
var->constant = true;
|
||||
|
||||
/* Part 1:
|
||||
|
@ -3856,12 +3856,12 @@ skipvar:
|
|||
|
||||
if (!localblock) {
|
||||
cval = (ast_value*)cexp;
|
||||
if (!ast_istype(cval, ast_value) || !cval->hasvalue)
|
||||
if (!ast_istype(cval, ast_value) || !cval->hasvalue || !cval->constant)
|
||||
parseerror(parser, "cannot initialize a global constant variable with a non-constant expression");
|
||||
else
|
||||
{
|
||||
if (opts_standard != COMPILER_GMQCC && !OPTS_FLAG(INITIALIZED_NONCONSTANTS) &&
|
||||
is_const_var >= 0)
|
||||
is_const_var != CV_VAR)
|
||||
{
|
||||
var->constant = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue