Handle bogus member l-value paths
Currently the procedural l-value path asserts if symbol lookup leaves a member tail for a variable that is not a struct or class. For example, `r.bad = 1'b1;` where `r` is a scalar variable aborts during elaboration instead of reporting a normal error. Report an error for the leftover member path before the assertion. This matches the r-value path behavior for the same kind of invalid member access. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
4e168a4d1f
commit
eaa7197602
|
|
@ -298,6 +298,15 @@ NetAssign_*PEIdent::elaborate_lval_var_(Design *des, NetScope *scope,
|
|||
// Past this point, we should have taken care of the cases
|
||||
// where the name is a member/method of a struct/class.
|
||||
// XXXX ivl_assert(*this, method_name.nil());
|
||||
if (!tail_path.empty()) {
|
||||
cerr << get_fileline() << ": error: Variable "
|
||||
<< reg->name()
|
||||
<< " does not have a field named: "
|
||||
<< tail_path << "." << endl;
|
||||
des->errors += 1;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ivl_assert(*this, tail_path.empty());
|
||||
|
||||
bool need_const_idx = is_cassign || is_force;
|
||||
|
|
|
|||
Loading…
Reference in New Issue