diff --git a/Changes b/Changes index 8952ba3e8..04cfda00b 100644 --- a/Changes +++ b/Changes @@ -29,6 +29,7 @@ Verilator 4.201 devel * Fix --public-flat-rw / DPI issue (#2858). [Todd Strader] * Fix interface localparam access (#2859). [Todd Strader] * Fix Cygwin example compile issues (#2856). [Mark Shaw] +* Fix select of with index variable (#2880). [Alexander Grobman] Verilator 4.200 2021-03-12 diff --git a/src/V3LinkResolve.cpp b/src/V3LinkResolve.cpp index 76339ebc2..09f71d11a 100644 --- a/src/V3LinkResolve.cpp +++ b/src/V3LinkResolve.cpp @@ -227,6 +227,9 @@ private: = VN_CAST(basefromp, UnlinkedRef)) { // Maybe unlinked - so need to clone nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::VAR_BASE, uvxrp->cloneTree(false))); + } else if (auto* fromp = VN_CAST(basefromp, LambdaArgRef)) { + nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::VAR_BASE, + fromp->cloneTree(false))); } else if (AstMemberSel* fromp = VN_CAST(basefromp, MemberSel)) { nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::MEMBER_BASE, fromp->cloneTree(false))); diff --git a/test_regress/t/t_queue_method.v b/test_regress/t/t_queue_method.v index 3e8dfbf1a..0446f406e 100644 --- a/test_regress/t/t_queue_method.v +++ b/test_regress/t/t_queue_method.v @@ -62,6 +62,8 @@ module t (/*AUTOARG*/); // TODO add a lint check that with clause is provided qv = q.find with (item == 2); v = $sformatf("%p", qv); `checks(v, "'{'h2, 'h2} "); + qv = q.find with (item[0] == 1); + v = $sformatf("%p", qv); `checks(v, "'{'h1, 'h3} "); qv = q.find_first with (item == 2); v = $sformatf("%p", qv); `checks(v, "'{'h2} "); qv = q.find_last with (item == 2);