Fix typedef `::` class reference error (#6862).

This commit is contained in:
Wilson Snyder 2025-12-24 10:01:46 -05:00
parent a0f0edd594
commit 397e64903c
4 changed files with 54 additions and 1 deletions

View File

@ -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

View File

@ -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");

View File

@ -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()

View File

@ -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