diff --git a/compiler2/Type.cc b/compiler2/Type.cc index 4602ccca5d28aefa2bdb5fe2c7f4b80fdf579189..6e8efcf1f828e094f60fd3947951b0fc7b613f5a 100644 --- a/compiler2/Type.cc +++ b/compiler2/Type.cc @@ -7580,7 +7580,23 @@ namespace Common { t = t->get_type_refd(); } else { - return string(); + switch (t->get_typetype_ttcn3()) { + case T_NULL: + case T_BOOL: + case T_INT: + case T_REAL: + case T_ENUM_T: + case T_BSTR: + case T_HSTR: + case T_OSTR: + case T_CSTR: + case T_USTR: + case T_OID: + // if the type is a base type, then it needs its own coder functions + return t->get_genname_own(p_scope); + default: + return string(); + } } } } diff --git a/regression_test/compileonly/Bug550623/.gitignore b/regression_test/compileonly/Bug550623/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d1453ab27c3455d0c24d834ea1b143c3d7dacdac --- /dev/null +++ b/regression_test/compileonly/Bug550623/.gitignore @@ -0,0 +1,4 @@ +Bug550623 +Bug550623.exe +Bug550623*.cc +Bug550623*.hh diff --git a/regression_test/compileonly/Bug550623/Bug550623.ttcn b/regression_test/compileonly/Bug550623/Bug550623.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..2dffebf10dd7bb064c96971022978cd3a78cdc52 --- /dev/null +++ b/regression_test/compileonly/Bug550623/Bug550623.ttcn @@ -0,0 +1,32 @@ +/****************************************************************************** + * Copyright (c) 2000-2019 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Baranyi, Botond + * + ******************************************************************************/ + +// the decoder functions for base types, that inherit 'encode' attributes from a higher scope +// (in this case the parent record), weren't generated, and their usages were generated incorrectly (bug 550623) +module Bug550623 { + +type record templateHexstr_rec { + hexstring x1, + hexstring x2, + hexstring x3 optional +} +with { + encode "RAW"; +} + +template templateHexstr_rec templateHexstr_tDecmatchSelfRef := { + x1 := '01A'H, + x2 := decmatch templateHexstr_tDecmatchSelfRef.x1, + x3 := decmatch templateHexstr_rec: { x1 := templateHexstr_tDecmatchSelfRef.x1, x2 := ?, x3 := * } +}; + +} diff --git a/regression_test/compileonly/Bug550623/Makefile b/regression_test/compileonly/Bug550623/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..2b2b02e35db007fcd031677429045fd78e4574b1 --- /dev/null +++ b/regression_test/compileonly/Bug550623/Makefile @@ -0,0 +1,50 @@ +############################################################################## +# Copyright (c) 2000-2019 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html +# +# Contributors: +# Botond, Baranyi +# +############################################################################## +TOPDIR := ../.. +include $(TOPDIR)/Makefile.regression + +.PHONY: all clean dep + +TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) + +TTCN3_MODULES = Bug550623.ttcn + +GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) +GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh) +ifdef CODE_SPLIT +GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc)) +else ifdef SPLIT_TO_SLICES +POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_)) +POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc)) +GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES))) +GENERATED_SOURCES += $(GENERATED_SOURCES2) +endif + +OBJECTS = $(GENERATED_SOURCES:.cc=.o) + +TARGET = Bug550623$(EXESUFFIX) + +all: $(TARGET) + +$(TARGET): $(GENERATED_SOURCES) $(USER_SOURCES) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ + -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS) + +$(GENERATED_SOURCES) $(GENERATED_HEADERS): $(TTCN3_MODULES) + $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ + +clean distclean: + $(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ + $(GENERATED_SOURCES) compile *.log + +dep: $(GENERATED_SOURCES) + makedepend $(CPPFLAGS) $(GENERATED_SOURCES) diff --git a/regression_test/compileonly/Makefile b/regression_test/compileonly/Makefile index 6be5170b4ff7c888e12dc3c51a333ac57119eff1..37e209bf1c3c8267b93828c16bd626ad6867c292 100644 --- a/regression_test/compileonly/Makefile +++ b/regression_test/compileonly/Makefile @@ -30,7 +30,8 @@ CODIRS := dynamicTemplate styleGuide topLevelPdu \ defaultParamUsageBeforeDecl deterministic readFromFile \ asn1_hyphen nameClash portTranslation UntaggedOnTopLevelUnionSwitch \ typeDescrGenWIthNoXER languageSpec asn1_opentype openTypeXER \ - asnStringSubtypes componentParameter realtimeKeywords Bug550526 + asnStringSubtypes componentParameter realtimeKeywords Bug550526 \ + Bug550623 ifdef DYN CODIRS += mfgen-xsd