diff --git a/elab_scope.cc b/elab_scope.cc index 236031907..a2f4c8e6b 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -253,8 +253,10 @@ static void elaborate_scope_enumeration(Design*des, NetScope*scope, } // If we are padding/truncating a negative value for an - // unsigned enumeration that is an error. - if ((cur_value.len() != enum_width) && + // unsigned enumeration that is an error or if the new + // value does not have a defined width. + if (((cur_value.len() != enum_width) || + ! cur_value.has_len()) && ! enum_type->signed_flag && cur_value.is_negative()) { cerr << use_enum->get_fileline() << ": error: Enumeration name " << cur->name