diff --git a/src/V3Fork.cpp b/src/V3Fork.cpp index 015b6e836c..59fb91ebc8 100644 --- a/src/V3Fork.cpp +++ b/src/V3Fork.cpp @@ -68,7 +68,7 @@ class ForkDynScopeFrame final { AstNode* const m_procp; // Procedure/block associated with that dynscope std::set m_captures; // Variables to be moved into the dynscope ForkDynScopeInstance m_instance; // Nodes to be injected into the AST to create the dynscope - size_t m_id; // Dynscope ID + const size_t m_id; // Dynscope ID public: ForkDynScopeFrame(AstNodeModule* modp, AstNode* procp, size_t id) @@ -339,6 +339,7 @@ class DynScopeVisitor final : public VNVisitor { void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); if (!VN_IS(nodep, Class)) m_modp = nodep; + m_id = 0; iterateChildren(nodep); } void visit(AstNodeFTask* nodep) override { @@ -619,6 +620,7 @@ class ForkVisitor final : public VNVisitor { void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); m_modp = nodep; + m_id = 0; iterateChildren(nodep); } void visit(AstNode* nodep) override {