diff --git a/Changes b/Changes index ee78d4b71..0379dbf2f 100644 --- a/Changes +++ b/Changes @@ -29,6 +29,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix $fwrite to constant stderr/stdout, bug961. [Wei Song] +**** Fix struct.enum.name method calls, bug855. [Jonathon Donaldson] + * Verilator 3.876 2015-08-12 diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 6e71180df..c848ea67c 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1389,7 +1389,7 @@ private: } else { AstSel* newp = new AstSel(nodep->fileline(), nodep->fromp()->unlinkFrBack(), memberp->lsb(), memberp->width()); - newp->dtypep(memberp->skipRefp()); // Must skip over the member to find the union; as the member may disappear later + newp->dtypep(memberp->subDTypep()->skipRefToEnump()); // Must skip over the member to find the union; as the member may disappear later newp->didWidth(true); // Don't replace dtype with basic type UINFO(9," MEMBERSEL -> "< "<dtypep()<1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_enum_name3.v b/test_regress/t/t_enum_name3.v new file mode 100644 index 000000000..d7613f2e8 --- /dev/null +++ b/test_regress/t/t_enum_name3.v @@ -0,0 +1,23 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2014 by Jonathon Donaldson. + +// bug855 +module our; + + typedef enum logic {n,N} T_Flg_N; + + typedef struct packed { + T_Flg_N N; + } T_PS_Reg; + + T_PS_Reg PS = 1'b1; + + initial begin + $write ("P:%s\n", PS.N.name); + $write("*-* All Finished *-*\n"); + $finish; + end + +endmodule