From 53bc514ea2baac2584de45da8f084314572058d3 Mon Sep 17 00:00:00 2001
From: Botond Baranyi <botond.baranyi@ericsson.com>
Date: Tue, 1 Dec 2020 13:05:17 +0100
Subject: [PATCH] Added extra code to external class skeletons to reset 'out'
 parameters + removed warning in generated code (bug 568899)

Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com>
Change-Id: I8c9ee720edd183711f709ad4c08629894747e1ed
---
 compiler2/ttcn3/AST_ttcn3.cc | 8 ++++++--
 compiler2/ttcn3/Statement.cc | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc
index 16857bf8d..ff46e56ee 100644
--- a/compiler2/ttcn3/AST_ttcn3.cc
+++ b/compiler2/ttcn3/AST_ttcn3.cc
@@ -8033,12 +8033,16 @@ namespace Ttcn {
       Free(body);
     }
     else if (in_class && my_scope->get_scope_class()->is_external()) {
+      char* out_par_str = enable_set_bound_out_param ? memptystr() :
+        fp_list->generate_code_set_unbound(memptystr());
       target->source.methods = mputprintf(target->source.methods,
         "%s %s::%s(%s)\n"
-        "{\n\n"
+        "{\n"
+        "%s\n"
         "}\n\n", return_type_str,
         my_scope->get_scope_class()->get_id()->get_name().c_str(),
-        genname_str, formal_par_list);
+        genname_str, formal_par_list, out_par_str);
+      Free(out_par_str);
     }
 
     Free(formal_par_list);
diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc
index 464c0bfd0..97fe67a1d 100644
--- a/compiler2/ttcn3/Statement.cc
+++ b/compiler2/ttcn3/Statement.cc
@@ -6891,7 +6891,7 @@ error:
   {
     expression_struct expr;
     Code::init_expr(&expr);
-    ref_pard->generate_code_const_ref(&expr);
+    ref_pard->generate_code(&expr);
     str=Code::merge_free_expr(str, &expr);
     return str;
   }
-- 
GitLab