diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc index 463ce4f5989bdf2215220a200d43204395666d5a..1bb7f0d6d05856e67d4035740199c91f1764c7e2 100644 --- a/compiler2/ttcn3/Statement.cc +++ b/compiler2/ttcn3/Statement.cc @@ -9065,7 +9065,9 @@ error: type->chk_this_template_ref(templ); self_ref |= type->chk_this_template_generic(templ, INCOMPLETE_ALLOWED, - OMIT_ALLOWED, ANY_OR_OMIT_ALLOWED, SUB_CHK, NOT_IMPLICIT_OMIT, lhs); + (type->get_parent_type() != NULL && !type->is_optional_field()) ? + OMIT_NOT_ALLOWED : OMIT_ALLOWED, + ANY_OR_OMIT_ALLOWED, SUB_CHK, NOT_IMPLICIT_OMIT, lhs); chk_template_restriction(); return; error: