Fix copy constructor of classes that use std::process (#5528)

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
This commit is contained in:
Ryszard Rozak 2024-10-10 14:40:07 +02:00 committed by GitHub
parent 230b145c04
commit 2a905c1d6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 3 deletions

View File

@ -1214,9 +1214,8 @@ public:
puts(")");
}
void visit(AstNewCopy* nodep) override {
putns(nodep, "VL_NEW(" + prefixNameProtect(nodep->dtypep()) + ", "
+ optionalProcArg(nodep->dtypep()));
puts("*"); // i.e. make into a reference
putns(nodep, "VL_NEW(" + prefixNameProtect(nodep->dtypep()));
puts(", *"); // i.e. make into a reference
iterateAndNextConstNull(nodep->rhsp());
puts(")");
}

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

View 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