ischosen for union has a bug
Submitted by Kristof Szabados
Assigned to Bence Janos Szabo
Link to original bug (#518551)
Description
According to the standard when ischosen is called on a template of a union, that has a value list it shall check if all element of the value list have the requested field as the active field.
And it also must be failsafe (not throwing DTE).
But the following code is generated " boolean simpleUnion_template::ischosen(simpleUnion::union_selection_type checked_selection) const { ... case VALUE_LIST: { if (value_list.n_values < 1) TTCN_error("Internal error: Performing ischosen() operation on a template of union type @akarmi.simpleUnion containing an empty list."); boolean ret_val = value_list.list_value[0].ischosen(checked_selection); boolean all_same = TRUE; for (unsigned int list_count = 1; list_count < value_list.n_values; list_count++) { if (value_list.list_value[list_count].ischosen(checked_selection) != ret_val){ all_same = FALSE; break; } } if (all_same) return ret_val; } case ANY_VALUE: case ANY_OR_OMIT: case OMIT_VALUE: case COMPLEMENTED_LIST: TTCN_error("Performing ischosen() operation on a template of union type @akarmi.simpleUnion, which does not determine unambiguously the chosen field of the matching values.");
... } "
which can result in DTE and is not doing the requested operation.
Version: 6.2.0