OOP: super-constructor call parameters can only be single expressions
Summary
In the current OOP implementation the parameters of a super-constructor call must be so-called 'single expressions' (i.e. a value/template simple enough that it translates to a single value in the C++ code). Structured values and most templates require multiple steps to initialize in C++. Normally these steps are performed on a temporary variable of the same type and this temporary is used instead of the value/template.
Steps and/or TTCN-3 code to reproduce
type record Rec {
integer num,
charstring str
}
type record of integer IntList;
type class C1 {
create(Rec p) { }
}
type class C2 extends C1 {
create(): C1( { 10, "abc" } ) { }
}
What is the current bug behavior?
Instead of the record value ( '{ 10, "abc" }' ) the compiler generates a reference to a temporary, that has is not declared or initialized anywhere, resulting in a C++ error in the generated code.
What is the expected correct behavior?
The temporary should be declared and initialized somewhere, before it is passed to the constructor of C1.
Relevant logs and/or screenshots
Possible fixes
Since the base-constructor call happens before anything else in the constructor in C++, it's not possible to declare and initialize these values/templates inside the constructor. Their initialization code could be generated inside a local function, and the function's return value could be used in the base-constructor call instead of temporary variables.
Titan version
8.1.0
Platform details (OS type and version)
Ubuntu 20.04
/cc @aknappqwt