From 2cb81ce6dc01c90296f263abc2ea37be8652cbda Mon Sep 17 00:00:00 2001
From: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
Date: Mon, 6 Feb 2017 13:01:09 +0100
Subject: [PATCH] Modifying the template param restictions of modified
 templates are allowed (Bug 511756)

Change-Id: If70fd151bcca1f4bbbdf7ac1a7cb2291d6c1a5c3
Signed-off-by: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
---
 compiler2/ttcn3/AST_ttcn3.cc                  |  7 +-
 .../template/TempRes_OK.ttcn                  | 64 +++++++++++++++++++
 2 files changed, 65 insertions(+), 6 deletions(-)
 create mode 100644 function_test/Semantic_Analyser/template/TempRes_OK.ttcn

diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc
index 439e0935f..2bc045e2b 100644
--- a/compiler2/ttcn3/AST_ttcn3.cc
+++ b/compiler2/ttcn3/AST_ttcn3.cc
@@ -4373,12 +4373,7 @@ namespace Ttcn {
       if (info_base.needs_conversion())
         body->set_needs_conversion();
     }
-    // Check for restriction.
-    if (Template::is_less_restrictive(base_template->get_template_restriction(),
-          template_restriction)) {
-      error("The template restriction is not the same or more "
-          "restrictive as of base template `%s'", ass->get_fullname().c_str());
-    }
+
     // Checking formal parameter lists.
     FormalParList *base_fpl = base_template->get_FormalParList();
     size_t nof_base_fps = base_fpl ? base_fpl->get_nof_fps() : 0;
diff --git a/function_test/Semantic_Analyser/template/TempRes_OK.ttcn b/function_test/Semantic_Analyser/template/TempRes_OK.ttcn
new file mode 100644
index 000000000..75ec620bd
--- /dev/null
+++ b/function_test/Semantic_Analyser/template/TempRes_OK.ttcn
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * Copyright (c) 2000-2016 Ericsson Telecom AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Szabo, Bence Janos
+ *
+ ******************************************************************************/
+module TempRes_OK {
+
+  template integer MyIntTemplate := 5;
+
+  template integer MyIntTemplate2 modifies MyIntTemplate := 5;
+
+  template (value) integer MyIntTemplate3 modifies MyIntTemplate := 5;
+
+  template (omit) integer MyIntTemplate4 modifies MyIntTemplate := 5;
+
+  template (present) integer MyIntTemplate5 modifies MyIntTemplate := 5;
+
+
+
+
+  template (value) integer MyValueIntTemplate := 5;
+
+  template (value) integer MyValueIntTemplate2 modifies MyValueIntTemplate := 5;
+
+  template integer MyValueIntTemplate3 modifies MyValueIntTemplate := 5;
+
+  template (omit) integer MyValueIntTemplate4 modifies MyValueIntTemplate := 5;
+
+  template (present) integer MyValueIntTemplate5 modifies MyValueIntTemplate := 5;
+
+
+
+
+  template (omit) integer MyOmitIntTemplate := 5;
+
+  template (omit) integer MyOmitIntTemplate2 modifies MyOmitIntTemplate := 5;
+
+  template (value) integer MyOmitIntTemplate3 modifies MyOmitIntTemplate := 5;
+
+  template integer MyOmitIntTemplate4 modifies MyOmitIntTemplate := 5;
+
+  template (present) integer MyOmitIntTemplate5 modifies MyOmitIntTemplate := 5;
+
+
+
+
+  template (present) integer MyPresentIntTemplate := 5;
+
+  template (present) integer MyPresentIntTemplate2 modifies MyPresentIntTemplate := 5;
+
+  template (omit) integer MyPresentIntTemplate3 modifies MyPresentIntTemplate := 5;
+
+  template (value) integer MyPresentIntTemplate4 modifies MyPresentIntTemplate := 5;
+
+  template integer MyPresentIntTemplate5 modifies MyPresentIntTemplate := 5;
+
+
+}
\ No newline at end of file
-- 
GitLab