519 |
if (!expr->isConstExpr()) { |
if (!expr->isConstExpr()) { |
520 |
PARSE_ERR(@5, (String("Assignment to const real number variable '") + name + "' requires const expression.").c_str()); |
PARSE_ERR(@5, (String("Assignment to const real number variable '") + name + "' requires const expression.").c_str()); |
521 |
} |
} |
522 |
ConstRealVariableRef var = new ConstRealVariable({ |
ConstRealVariableRef var = new ConstRealVariable( |
523 |
|
#if defined(__GNUC__) && !defined(__clang__) |
524 |
|
(const RealVarDef&) // GCC 8.x requires this cast here (looks like a GCC bug to me); cast would cause an error with clang though |
525 |
|
#endif |
526 |
|
{ |
527 |
.value = (expr->isConstExpr()) ? expr->evalReal() : vmfloat(0), |
.value = (expr->isConstExpr()) ? expr->evalReal() : vmfloat(0), |
528 |
.unitFactor = (expr->isConstExpr()) ? expr->unitFactor() : VM_NO_FACTOR, |
.unitFactor = (expr->isConstExpr()) ? expr->unitFactor() : VM_NO_FACTOR, |
529 |
.unitType = expr->unitType(), |
.unitType = expr->unitType(), |
538 |
if (!expr->isConstExpr()) { |
if (!expr->isConstExpr()) { |
539 |
PARSE_ERR(@5, (String("Assignment to const integer variable '") + name + "' requires const expression.").c_str()); |
PARSE_ERR(@5, (String("Assignment to const integer variable '") + name + "' requires const expression.").c_str()); |
540 |
} |
} |
541 |
ConstIntVariableRef var = new ConstIntVariable({ |
ConstIntVariableRef var = new ConstIntVariable( |
542 |
|
#if defined(__GNUC__) && !defined(__clang__) |
543 |
|
(const IntVarDef&) // GCC 8.x requires this cast here (looks like a GCC bug to me); cast would cause an error with clang though |
544 |
|
#endif |
545 |
|
{ |
546 |
.value = (expr->isConstExpr()) ? expr->evalInt() : 0, |
.value = (expr->isConstExpr()) ? expr->evalInt() : 0, |
547 |
.unitFactor = (expr->isConstExpr()) ? expr->unitFactor() : VM_NO_FACTOR, |
.unitFactor = (expr->isConstExpr()) ? expr->unitFactor() : VM_NO_FACTOR, |
548 |
.unitType = expr->unitType(), |
.unitType = expr->unitType(), |