From 46951c778e6828ff1f8d068f62a838360cbf66a5 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 4 Oct 2022 12:04:12 +0200 Subject: [PATCH] Handle default argument values for class function method calls For class function method calls currently only as many arguments as have been supplied are elaborated. Any trailing arguments that might have default values are skipped. This will trigger an assertion later on in the vvp code generator backend. Fix this by making sure that all arguments of the function are evaluated. Note that this already works correctly for class task method calls. Signed-off-by: Lars-Peter Clausen --- elab_expr.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elab_expr.cc b/elab_expr.cc index c643f1466..530f47b7e 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -3185,13 +3185,13 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope, NetNet*res = method->find_signal(method->basename()); ivl_assert(*this, res); - vectorparms; + vector parms(def->port_count()); + ivl_assert(*this, def->port_count() >= 1); NetESignal*ethis = new NetESignal(net); ethis->set_line(*this); - parms.push_back(ethis); + parms[0] = ethis; - parms.resize(1 + parms_.size()); elaborate_arguments_(des, scope, def, false, parms, 1); NetESignal*eres = new NetESignal(res);