Skip to content

Two fields of same union type variable can be used of inout parameters of same function

Summary

Giving two fields of the same union variable as actual parameters of the same function call shall result in error according to paragraph m) of section 5.4.2 of the TTCN-3 standard. Yet, TITAN allows this.

Steps and/or TTCN-3 code to reproduce

Create module with

type component ct_empty{}

type union myun{
  integer field1,
  integer field2
}

function fn_no_union_fields_as_inout(inout integer i1, inout integer i2){
  i1 := 3;
  i2 := 4;
}

testcase tc_no_union_fields_as_inout() runs on ct_empty{
  var myun ui;
  ui.field1 := 1;
  ui.field2 := 2;
  fn_no_union_fields_as_inout(ui.field1, ui.field2);
  log(ui);
  setverdict(pass);
}

Compile and execute.

What is the current bug behavior?

Test passes.

What is the expected correct behavior?

Compilation error

Relevant logs and/or screenshots

Possible fixes

Titan version

8.1.0

Platform details (OS type and version)

Microsoft Windows 10 Enterprise 10.0.19042

/cc @aknappqwt

Edited by Levente Erős