From 33468fa0e7f33674d2cdf110294d70247c90fbe7 Mon Sep 17 00:00:00 2001 From: Ryszard Rozak Date: Thu, 2 Feb 2023 23:59:47 +0100 Subject: [PATCH] Fix class extend parameter dot case (#3926) --- src/V3LinkDot.cpp | 4 ++-- test_regress/t/t_class_param.v | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 40f1cbf5e..e0c98053b 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -2440,13 +2440,13 @@ private: } } } - const bool unresolvedClass = m_ds.m_unresolvedClass; if (start) { m_ds = lastStates; } else { + const bool unresolvedClass = m_ds.m_unresolvedClass; m_ds.m_dotp = lastStates.m_dotp; + m_ds.m_unresolvedClass |= unresolvedClass; } - m_ds.m_unresolvedClass |= unresolvedClass; } void visit(AstSenItem* nodep) override { VL_RESTORER(m_inSens); diff --git a/test_regress/t/t_class_param.v b/test_regress/t/t_class_param.v index bcb9fa22c..5b9b2a451 100644 --- a/test_regress/t/t_class_param.v +++ b/test_regress/t/t_class_param.v @@ -81,6 +81,15 @@ class ClsParam #(type T); typedef T param_t; endclass +class ClsWithParamField; + int m_field = Sum#(int)::sum; + int m_queue[$]; + + function int get(int index); + return m_queue[index]; + endfunction +endclass + module t (/*AUTOARG*/); Cls c12; @@ -93,6 +102,7 @@ module t (/*AUTOARG*/); SelfRefClassIntParam src1; SelfRefClassIntParam::self_int_t src10; IntQueue qi; + ClsWithParamField cls_param_field; int arr [1:0] = '{1, 2}; initial begin c12 = new; @@ -105,6 +115,7 @@ module t (/*AUTOARG*/); src1 = new; src10 = new; qi = new; + cls_param_field = new; if (Cls#()::PBASE != 12) $stop; if (Cls#(4)::PBASE != 4) $stop; if (Cls8_t::PBASE != 8) $stop; @@ -153,6 +164,9 @@ module t (/*AUTOARG*/); if (ClsParam#(ClsStatic)::param_t::x != 1) $stop; if (ClsParam#(ClsStatic)::param_t::get_2() != 2) $stop; + cls_param_field.m_queue = '{1, 5, 7}; + if (cls_param_field.get(2) != 7) $stop; + $write("*-* All Finished *-*\n"); $finish; end