Fix lifetime unknown error on enum.name (#4448).

This commit is contained in:
Wilson Snyder 2023-08-30 07:20:25 -04:00
parent b4b74d72f0
commit ccdb52c1d9
3 changed files with 7 additions and 2 deletions

View File

@ -29,6 +29,7 @@ Verilator 5.015 devel
* Fix nested assignments on the LHS (#4435). [Ryszard Rozak, Antmicro Ltd]
* Fix false MULTITOP on bound interfaces (#4438). [Alex Solomatnikov]
* Fix internal error on real conversion (#4447). [vdhotre-ventana]
* Fix lifetime unknown error on enum.name (#4448). [jwoutersymatra]
Verilator 5.014 2023-08-06

View File

@ -7203,6 +7203,7 @@ private:
"__Venumtab_" + VString::downcase(attrType.ascii())
+ cvtToStr(m_dtTables++),
vardtypep};
varp->lifetime(VLifetime::STATIC);
varp->isConst(true);
varp->isStatic(true);
varp->valuep(initp);

View File

@ -6,14 +6,17 @@
event evt1;
typedef enum {ENUM_VALUE} enum_t;
class Foo;
int m_member;
enum_t m_en;
task do_something();
fork
#20 begin
m_member++;
$display("this's m_member: ", m_member);
$display("this's m_member: %0d m_en: %s", m_member, m_en.name());
if (m_member != 3)
$stop;
->evt1;
@ -29,7 +32,7 @@ class Foo;
fork
begin
foo.m_member++;
$display("foo's m_member: %d", foo.m_member);
$display("foo's m_member: %0d m_en: %s", foo.m_member, foo.m_en.name());
if (foo.m_member != 2)
$stop;
end