verilator/test_regress/t/t_class_param_bad_paren.v

34 lines
664 B
Systemverilog
Raw Normal View History

// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2023 Antmicro Ltd
// SPDX-License-Identifier: CC0-1.0
2026-03-10 02:38:29 +01:00
class Cls #(
int PARAM = 1
);
parameter OTHER = 12;
endclass
2026-03-10 02:38:29 +01:00
class Other extends Cls #(); // Ok
endclass
class OtherMaybe extends Cls; // Questionable but others do not warn
endclass
module t;
2026-03-10 02:38:29 +01:00
typedef Cls#(2) Cls2_t; // Ok
typedef Cls ClsNone_t; // Ok
2026-03-10 02:38:29 +01:00
Cls c; // Ok
2026-03-10 02:38:29 +01:00
initial begin
if (Cls#()::OTHER != 12) $stop; // Ok
if (Cls2_t::OTHER != 12) $stop; // ok
2026-03-10 02:38:29 +01:00
if (Cls::OTHER != 12) $stop; // Bad #() required
end
endmodule