mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Fix copy constructor of classes that use std::process (#5528)
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
This commit is contained in:
parent
230b145c04
commit
2a905c1d6e
@ -1214,9 +1214,8 @@ public:
|
|||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
void visit(AstNewCopy* nodep) override {
|
void visit(AstNewCopy* nodep) override {
|
||||||
putns(nodep, "VL_NEW(" + prefixNameProtect(nodep->dtypep()) + ", "
|
putns(nodep, "VL_NEW(" + prefixNameProtect(nodep->dtypep()));
|
||||||
+ optionalProcArg(nodep->dtypep()));
|
puts(", *"); // i.e. make into a reference
|
||||||
puts("*"); // i.e. make into a reference
|
|
||||||
iterateAndNextConstNull(nodep->rhsp());
|
iterateAndNextConstNull(nodep->rhsp());
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
|
18
test_regress/t/t_process_copy_constr.py
Executable file
18
test_regress/t/t_process_copy_constr.py
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/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('simulator')
|
||||||
|
|
||||||
|
test.compile(verilator_flags2=["--timing"])
|
||||||
|
|
||||||
|
test.execute()
|
||||||
|
|
||||||
|
test.passes()
|
25
test_regress/t/t_process_copy_constr.v
Normal file
25
test_regress/t/t_process_copy_constr.v
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||||
|
// any use, without warranty, 2024 by Antmicro.
|
||||||
|
// SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
class Cls;
|
||||||
|
int x = 1;
|
||||||
|
function new();
|
||||||
|
int p = process::self();
|
||||||
|
endfunction
|
||||||
|
endclass
|
||||||
|
|
||||||
|
module t (/*AUTOARG*/
|
||||||
|
);
|
||||||
|
initial begin
|
||||||
|
Cls c, d;
|
||||||
|
c = new;
|
||||||
|
c.x = 2;
|
||||||
|
d = new c;
|
||||||
|
if (d.x != 2) $stop;
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
endmodule
|
Loading…
Reference in New Issue
Block a user