diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc index c1d1fa35303aa691b6623d2e4e7eafd3454a9313..acbbab69a29b5e8052c027bfc5a9255ae42e7426 100644 --- a/compiler2/ttcn3/AST_ttcn3.cc +++ b/compiler2/ttcn3/AST_ttcn3.cc @@ -4311,6 +4311,7 @@ namespace Ttcn { void Def_Template::chk() { if (checked) return; + checked = true; Error_Context cntxt(this, "In template definition `%s'", id->get_dispname().c_str()); const string& t_genname = get_genname(); @@ -4350,7 +4351,6 @@ namespace Ttcn { } type->chk_this_template_ref(body); - checked = true; Type *t = type->get_type_refd_last(); if (t->get_typetype() == Type::T_PORT) { error("Template cannot be defined for port type `%s'", diff --git a/function_test/Semantic_Analyser/template/TempImp_OK.ttcn b/function_test/Semantic_Analyser/template/TempImp_OK.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..f29bdeb63bd78f0002d113998cd5d2a6351d58ce --- /dev/null +++ b/function_test/Semantic_Analyser/template/TempImp_OK.ttcn @@ -0,0 +1,17 @@ +/****************************************************************************** + * Copyright (c) 2000-2017 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: + * Baranyi, Botond + * + ******************************************************************************/ + +module TempImp_OK { + +type integer T; + +} diff --git a/function_test/Semantic_Analyser/template/TempNameReuse_SE.ttcn b/function_test/Semantic_Analyser/template/TempNameReuse_SE.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..03831f159c8b721c7cab95ba4ebc3c243c279b40 --- /dev/null +++ b/function_test/Semantic_Analyser/template/TempNameReuse_SE.ttcn @@ -0,0 +1,19 @@ +/****************************************************************************** + * Copyright (c) 2000-2017 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: + * Baranyi, Botond + * + ******************************************************************************/ + +module TempNameReuse_SE { //^In TTCN-3 module// + +import from TempImp_OK all; + +template T T := 1; //^In template definition// //is not a reference to a type// + +}