From 49accd8b4e67af3118af68e11578cd6b867aa12c Mon Sep 17 00:00:00 2001
From: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
Date: Tue, 5 Dec 2017 09:45:55 +0100
Subject: [PATCH] OER regtest fixes

Change-Id: I80bf68a44a6026f343f0c516fa3c0a60586505c8
Signed-off-by: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
---
 compiler2/Type_chk.cc        | 8 ++++++++
 compiler2/record.c           | 2 +-
 regression_test/OER/OER.ttcn | 7 +++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/compiler2/Type_chk.cc b/compiler2/Type_chk.cc
index fc74f72ea..4a1b02784 100644
--- a/compiler2/Type_chk.cc
+++ b/compiler2/Type_chk.cc
@@ -3152,7 +3152,15 @@ void Type::chk_oer() {
       se_comps.clear();
       se_comps2.clear();
     }
+    // no break
     case T_SEQ_A: {
+      // These asn1 types are sequences but don't need any checking.
+      // It could screw up XER coding for example.
+      if (t->get_typename().find("CHARACTER STRING", 0) != t->get_typename().size() ||
+          t->get_typename().find("EMBEDDED PDV", 0) != t->get_typename().size() ||
+          t->get_typename().find("@EXTERNAL", 0) != t->get_typename().size()) {
+        break;
+      }
       oerattrib->extendable = t->u.secho.ctss->has_ellipsis();
       if (oerattrib->extendable) {
         oerattrib->nr_of_root_comps = t->u.secho.ctss->get_nof_root_comps();
diff --git a/compiler2/record.c b/compiler2/record.c
index 53333fec1..38f8fcf35 100644
--- a/compiler2/record.c
+++ b/compiler2/record.c
@@ -4655,7 +4655,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output)
   if (oer_needed) {
     // OER encode, RT1
     src = mputprintf(src,
-      "int %s::OER_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const\n"
+      "int %s::OER_encode(const TTCN_Typedescriptor_t&, TTCN_Buffer& p_buf) const\n"
       "{\n"
       "  if (!is_bound()) {\n" 
       "  TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND,\n"
diff --git a/regression_test/OER/OER.ttcn b/regression_test/OER/OER.ttcn
index 775f39a57..dfd8ea787 100644
--- a/regression_test/OER/OER.ttcn
+++ b/regression_test/OER/OER.ttcn
@@ -2279,6 +2279,13 @@
  			setverdict(fail, "tc_sequence: ", match(er, erres));
  		}
 
+        er := { me := 1, me2 := 2 }
+        os := '8001010102020780020103'O;
+        erres := dec_ExtensionRecord(os);
+        if (er != erres) {
+            setverdict(fail, "tc_sequence: ", match(er, erres));
+        }
+
         var ExtensionRecord2 er2, erres2;
         er2 := {
             me := 1,
-- 
GitLab