Tests: Add t_param_type_bad3

This commit is contained in:
Wilson Snyder 2025-05-06 21:11:34 -04:00
parent b099d6fe63
commit bc3bf6ab5e
5 changed files with 39 additions and 4 deletions

View File

@ -3341,8 +3341,8 @@ class LinkDotResolveVisitor final : public VNVisitor {
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
} else if (AstConstraint* const consp = VN_CAST(foundp->nodep(), Constraint)) {
AstNode* const newp = new AstConstraintRef{nodep->fileline(), nullptr, consp};
} else if (AstConstraint* const defp = VN_CAST(foundp->nodep(), Constraint)) {
AstNode* const newp = new AstConstraintRef{nodep->fileline(), nullptr, defp};
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
ok = true;

View File

@ -928,7 +928,7 @@ class ParamProcessor final {
for (auto* stmtp = srcModpr->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
if (AstParamTypeDType* dtypep = VN_CAST(stmtp, ParamTypeDType)) {
if (VN_IS(dtypep->subDTypep(), VoidDType)) {
if (VN_IS(dtypep->skipRefp(), VoidDType)) {
nodep->v3error(
"Class parameter type without default value is never given value"
<< " (IEEE 1800-2023 6.20.1): " << dtypep->prettyNameQ());
@ -1217,7 +1217,7 @@ class ParamVisitor final : public VNVisitor {
}
void visit(AstParamTypeDType* nodep) override {
iterateChildren(nodep);
if (VN_IS(nodep->subDTypep(), VoidDType)) {
if (VN_IS(nodep->skipRefp(), VoidDType)) {
nodep->v3error("Parameter type without default value is never given value"
<< " (IEEE 1800-2023 6.20.1): " << nodep->prettyNameQ());
}

View File

@ -0,0 +1,5 @@
%Error: t/t_param_type_bad3.v:9:26: Expecting a data type: 'PI'
9 | localparam type P_T = PI;
| ^~
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: Exiting due to

View File

@ -0,0 +1,20 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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('vlt')
test.lint(
# Bug1575 required trace to crash
verilator_flags2=["--trace-vcd"],
fails=True,
expect_filename=test.golden_filename)
test.passes()

View File

@ -0,0 +1,10 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2019 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t;
localparam int PI = 6;
localparam type P_T = PI; // Bad
endmodule