diff --git a/Changes b/Changes index 273c0537f..507ee9786 100644 --- a/Changes +++ b/Changes @@ -124,6 +124,7 @@ Verilator 5.043 devel * Fix JSON missing `signed` indication (#6845). * Fix class reference throwing cannot detect changes error (#6851). * Fix `randc` on extended class (#6852). +* Fix typedef `::` class reference error (#6862). Verilator 5.042 2025-11-02 diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index ce83b9083..acc42e2a4 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -3281,7 +3281,7 @@ class LinkDotResolveVisitor final : public VNVisitor { // Cell: Recurse inside or cleanup not founds LINKDOT_VISIT_START(); UINFO(5, indent() << "visit " << nodep); - checkNoDot(nodep); + // Can be under dot if called as package::class and that class resolves, so no checkNoDot VL_RESTORER(m_usedPins); m_usedPins.clear(); UASSERT_OBJ(nodep->classp(), nodep, "ClassRef has unlinked class"); diff --git a/test_regress/t/t_class_extends_dot.py b/test_regress/t/t_class_extends_dot.py new file mode 100755 index 000000000..bd059b0f2 --- /dev/null +++ b/test_regress/t/t_class_extends_dot.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2025 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('simulator') + +test.compile(verilator_flags2=['--binary']) + +test.execute() + +test.passes() diff --git a/test_regress/t/t_class_extends_dot.v b/test_regress/t/t_class_extends_dot.v new file mode 100644 index 000000000..70f89a925 --- /dev/null +++ b/test_regress/t/t_class_extends_dot.v @@ -0,0 +1,34 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2025 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +package pkg; + class object_registry #( + type T = int + ); + endclass + + class packer; + typedef object_registry#(packer) type_id; + endclass +endpackage + +package c_pkg; + import pkg::*; + class compat_packer extends pkg::packer; + typedef object_registry#(c_pkg::compat_packer) type_id; + endclass +endpackage + +import pkg::*; +import c_pkg::*; + +module t; + initial begin + compat_packer c; + c = new(); + $finish; + end +endmodule