- allocInfo = 0;
-
- // set ival's lineno to where the symbol was defined
- if (ival) ival->lineno=sym->lineDef;
- eBBlockFromiCode (iCodeFromAst (ival));
- allocInfo = 1;
+
+ if (ival) {
+ // set ival's lineno to where the symbol was defined
+ lineno=ival->lineno=sym->lineDef;
+
+ // check if this is a constant expression
+ if (constExprTree(ival->right)) {
+ allocInfo = 0;
+ eBBlockFromiCode (iCodeFromAst (ival));
+ allocInfo = 1;
+ } else {
+ werror (E_CONST_EXPECTED, "found expression");
+ }
+ }