Operand of increment/decrement should not be a number
The patch adds necessary error checking to verify that the operands of increment decrement operator is not number. Signed-off-by: Prasad Joshi <prasad@canopusconsultancy.com>
This commit is contained in:
parent
51b1d57f19
commit
5311aeaa19
10
elab_expr.cc
10
elab_expr.cc
|
|
@ -3646,6 +3646,16 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
|
|||
des->errors += 1;
|
||||
return 0;
|
||||
} else if (t == IVL_VT_LOGIC || t == IVL_VT_BOOL) {
|
||||
if (dynamic_cast<NetEConst *> (ip)) {
|
||||
/* invalid operand: operand is a constant number */
|
||||
cerr << get_fileline() << ": error: "
|
||||
<< "inappropriate use of "
|
||||
<< human_readable_op(op_, true)
|
||||
<< " operator." << endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
tmp = new NetEUnary(op_, ip, expr_wid, signed_flag_);
|
||||
tmp->set_line(*this);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue