diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc index 1bb7f0d6d05856e67d4035740199c91f1764c7e2..0363c48f064109cd2e6151ec5feaa82c09c22038 100644 --- a/compiler2/ttcn3/Statement.cc +++ b/compiler2/ttcn3/Statement.cc @@ -10707,8 +10707,14 @@ error: expression_struct var_ref_expr; Code::init_expr(&var_ref_expr); inst_params_str = mputstr(inst_params_str, "&("); - v[i]->get_var_ref()->generate_code(&var_ref_expr); + Reference* ref = v[i]->get_var_ref(); + ref->generate_code(&var_ref_expr); inst_params_str = mputstr(inst_params_str, var_ref_expr.expr); + if (ref->get_refd_assignment()->get_Type()->get_type_refd_last()-> + get_field_type(ref->get_subrefs(), + Common::Type::EXPECTED_DYNAMIC_VALUE)->is_optional_field()) { + inst_params_str = mputstr(inst_params_str, "()"); + } inst_params_str = mputc(inst_params_str, ')'); if (var_ref_expr.preamble != NULL) { expr->preamble = mputstr(expr->preamble, var_ref_expr.preamble);