diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc index a268ecbfaab63447adb20c6472397ea8aad14acb..5e85c8af7c32e1a42978d30373f57f0b4144a114 100644 --- a/compiler2/ttcn3/AST_ttcn3.cc +++ b/compiler2/ttcn3/AST_ttcn3.cc @@ -1231,7 +1231,7 @@ namespace Ttcn { base_type->get_genname_own(my_scope).c_str()); } if (reftype == REF_VALUE) { - expr->expr = mputstr(expr->expr, "value"); + expr->expr = mputstr(expr->expr, ass->get_genname_from_scope(my_scope).c_str()); } else { if (parlist != NULL) { @@ -10042,8 +10042,7 @@ namespace Ttcn { } if (!used_as_lvalue) { Definition *my_def = my_parlist->get_my_def(); - if (!my_def) FATAL_ERROR("FormalPar::use_as_lvalue()"); - if (my_def->get_asstype() == A_TEMPLATE) + if (my_def != NULL && my_def->get_asstype() == A_TEMPLATE) p_loc.error("Parameter `%s' of the template cannot be passed further " "as `out' or `inout' parameter", id->get_dispname().c_str()); else { diff --git a/compiler2/ttcn3/TtcnTemplate.cc b/compiler2/ttcn3/TtcnTemplate.cc index b98500b6b7ffd7da50cfa1f07a2639c29f860b0e..1301fa938f691735ad6ab3bb537647e5e6becb89 100644 --- a/compiler2/ttcn3/TtcnTemplate.cc +++ b/compiler2/ttcn3/TtcnTemplate.cc @@ -5493,6 +5493,8 @@ compile_time: str = create_location_object(str, "TEMPLATE", "@dynamic template"); } + str = u.dynamic.fp_list->generate_shadow_objects(str); + // todo: what do we do with @update statements in the dynamic template's block? char* dummy_def_glob_vars = NULL; char* dummy_src_glob_vars = NULL; diff --git a/regression_test/templateInt/TtemplateInt.ttcn b/regression_test/templateInt/TtemplateInt.ttcn index 8e3c6f7f87786c048a0e33f255db4f76a35c88fd..311ba2af8def8b2ff8fcc09dd195cb258846d9bb 100644 --- a/regression_test/templateInt/TtemplateInt.ttcn +++ b/regression_test/templateInt/TtemplateInt.ttcn @@ -447,12 +447,11 @@ template integer t_implication := (0..infinity) implies @dynamic f_is_prime; // matches if the number of digits matches the template parameter template integer t_dynamic(template integer pt_digit_template) := @dynamic { - var integer x := value; - if (x < 0) { x := -x; } + if (value < 0) { value := -value; } var integer v_num_digits := 0; - while (x > 0) { + while (value > 0) { v_num_digits := v_num_digits + 1; - x := x / 10; + value := value / 10; } return match(v_num_digits, pt_digit_template); }