From 1b72cb264a0cf180e0b491cc4a7f77b14beca525 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sun, 25 Nov 2012 20:25:39 +0100 Subject: [PATCH] more on CV_CONST/CV_VAR, initializers to check 'constant' not just 'hasvalue' --- parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parser.c b/parser.c index 2b944ca..6e440cd 100644 --- a/parser.c +++ b/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; } -- 2.39.2