From 306465d2064aae8d1f559e827b50c93bb7ae756d Mon Sep 17 00:00:00 2001
From: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
Date: Fri, 24 Mar 2017 15:24:37 +0100
Subject: [PATCH] Fixed select union code generation error (Bug 514180)

Change-Id: Icf678f4c3f9580802283d8b915f39bf9e40a20d3
Signed-off-by: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
---
 compiler2/ttcn3/Statement.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc
index fcabbcc30..b788b6e3f 100644
--- a/compiler2/ttcn3/Statement.cc
+++ b/compiler2/ttcn3/Statement.cc
@@ -6587,7 +6587,8 @@ error:
       str = mputstr(str, expr.preamble);
     }
     str = mputprintf(str, "switch(%s.get_selection()) {\n", expr.expr);
-    const char* type_name = select_union.expr->get_expr_governor_last()->get_genname_value(select_union.expr->get_my_scope()).c_str();
+    string type_name_str = select_union.expr->get_expr_governor_last()->get_genname_value(select_union.expr->get_my_scope());
+    const char* type_name = type_name_str.c_str();
     char* loc = NULL;
     loc = select_union.expr->update_location_object(loc);
     str = select_union.sus->generate_code(str, def_glob_vars, src_glob_vars, type_name, loc);
@@ -6963,7 +6964,8 @@ error:
       str = mputstr(str, expr.preamble);
     }
     str = mputprintf(str, "switch(%s.get_selection()) {\n", expr.expr);
-    const char* type_name = select_union.expr->get_expr_governor_last()->get_genname_value(select_union.expr->get_my_scope()).c_str();
+    string type_name_str = select_union.expr->get_expr_governor_last()->get_genname_value(select_union.expr->get_my_scope());
+    const char* type_name = type_name_str.c_str();
     char* loc = NULL;
     loc = select_union.expr->update_location_object(loc);
     str = select_union.sus->generate_code(str, ilt->get_out_def_glob_vars(),
-- 
GitLab