OOP: using class method return value as external function parameter
The use of return values of class methods as actual parameters of external functions is not handled correctly by the compiler. In the example below a class method returning a template is passed to a parameter expecting a value. This is not caught at compile-time, and it causes a C++ compilation error.
type record of integer IntList
with {
encode "JSON";
}
external function f_enc_il(in IntList x) return octetstring
with { extension "prototype(convert) encode(JSON)" }
type class ExampleClass {
private template IntList t := { 0, 1, 2, 3 }
public function get_list() return template IntList { return t; }
}
function test() {
var ExampleClass x := ExampleClass.create;
var octetstring res := f_enc_il(x.get_list()); // C++ compilation error
}
/cc @aknappqwt @mmagyari
Edited by Botond Baranyi