diff --git a/compiler2/Type_chk.cc b/compiler2/Type_chk.cc index 1a2c80f870e2b7859c08d89ab8a7fa657506dc70..0b760a2a5cc0d2c04709dbe6a864534e8b6a0c77 100644 --- a/compiler2/Type_chk.cc +++ b/compiler2/Type_chk.cc @@ -1489,7 +1489,7 @@ void Type::chk_xer_embed_values(int num_attributes) enum complaint_type { ALL_GOOD, HAVE_DEFAULT, UNTAGGED_EMBEDVAL, NOT_SEQUENCE, EMPTY_SEQUENCE, FIRST_NOT_SEQOF, SEQOF_NOT_STRING, - SEQOF_BAD_LENGTH, UNTAGGED_OTHER } ; + SEQOF_BAD_LENGTH, UNTAGGED_OTHER, ATTRIBUTE_EMBEDVAL } ; complaint_type complaint = ALL_GOOD; size_t expected_length = (size_t)-1; Type *cf0t = 0; // type of first component @@ -1519,6 +1519,12 @@ void Type::chk_xer_embed_values(int num_attributes) complaint = UNTAGGED_EMBEDVAL; // 25.2.2 break; } + // Either the type of the field or the last_refd type of the field + if ((cf0->get_type()->xerattrib && cf0->get_type()->xerattrib->attribute_) + || (cf0t->xerattrib && cf0t->xerattrib->attribute_)) { + complaint = ATTRIBUTE_EMBEDVAL; + break; + } // Check length restriction on the record of. If there is one, // it better be the correct number. @@ -1589,6 +1595,9 @@ void Type::chk_xer_embed_values(int num_attributes) cf->error("There shall be no UNTAGGED on any character-encodable " "component of a type with DEFAULT-FOR-EMPTY"); // 25.2.3 break; + case ATTRIBUTE_EMBEDVAL: + error("The SEQUENCE-OF supporting EMBED-VALUES must not have ATTRIBUTE."); + break; } // switch(complaint) } // if complaint and embedValues } diff --git a/function_test/Semantic_Analyser/xer/emb_first_attrib_SE.ttcn b/function_test/Semantic_Analyser/xer/emb_first_attrib_SE.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..bda0fd68489ccc858159a582ff619afff5bcce57 --- /dev/null +++ b/function_test/Semantic_Analyser/xer/emb_first_attrib_SE.ttcn @@ -0,0 +1,26 @@ +/****************************************************************************** + * 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: + * Szabo, Bence Janos + * + ******************************************************************************/ +module emb_first_attrib_SE { //^In TTCN-3 module `emb_first_attrib_SE':// + +type record e1 { //^In type definition// //^error: The SEQUENCE\-OF supporting EMBED\-VALUES must not have ATTRIBUTE\.// + record of universal charstring field_1 +} +with { + variant "embedValues" + variant (field_1) "attribute" +} + + +} +with { +encode "XML" +}