From 1346eb3f09ff4766007830724bfca8ab7f0c7f6b Mon Sep 17 00:00:00 2001
From: Botond Baranyi <botond.baranyi@ericsson.com>
Date: Thu, 25 Nov 2021 17:52:27 +0100
Subject: [PATCH] Fixed minor issues created by the last OOP commit (issue
 #577)

Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com>
---
 compiler2/Type_chk.cc | 4 +++-
 compiler2/Value.cc    | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/compiler2/Type_chk.cc b/compiler2/Type_chk.cc
index ce9393795..8450d34f1 100644
--- a/compiler2/Type_chk.cc
+++ b/compiler2/Type_chk.cc
@@ -4021,7 +4021,9 @@ bool Type::chk_this_value(Value *value, Common::Assignment *lhs, expected_value_
     chk_this_invoked_value(value, lhs, expected_value);
     return false; // assumes no self-reference in invoke
   case Value::V_EXPR:
-    self_ref = value->chk_expr_self_ref(lhs, class_member_init);
+    if (lhs != NULL || class_member_init) {
+      self_ref = value->chk_expr_self_ref(lhs, class_member_init);
+    }
     // no break
   case Value::V_MACRO:
     if (value->is_unfoldable(0, expected_value)) {
diff --git a/compiler2/Value.cc b/compiler2/Value.cc
index f15cf586a..257a799df 100644
--- a/compiler2/Value.cc
+++ b/compiler2/Value.cc
@@ -15056,7 +15056,8 @@ void Value::chk_expr_operand_execute_refd(Value *v1,
     if (t_ass == NULL || t_ass->get_asstype() != Assignment::A_TYPE) {
       FATAL_ERROR("Value::generate_code_expr_class_create()");
     }
-    ap_list->generate_code_noalias(expr, t_ass->get_FormalParList());
+    ap_list->generate_code_noalias(expr,
+      t_ass->get_Type()->get_class_type_body()->get_constructor()->get_FormalParList());
     expr->expr = mputc(expr->expr, ')');
   }
 
-- 
GitLab