Closed
Description
Describe the bug
When skipping initialization for some struct fields, a codegen error pops up due to said skipped value not being generated. For example
TYPE STRUCT1 : STRUCT
node : DINT;
myArr : ARRAY[0..1] OF STRUCT2;
END_STRUCT END_TYPE
TYPE STRUCT2 : STRUCT
x1 : INT;
x2 : INT;
END_STRUCT END_TYPE
PROGRAM main
VAR
var_init1 : ARRAY[0..1] OF STRUCT1 := [
(node := 0, myArr := [(x1 := 0)])
];
END_VAR
END_PROGRAM
will yield the following error
error: Some initial values were not generated
Codegen Error: Compilation aborted due to previous errors
Similarly this will not work (myArr := [(x1 := 0, x2 := 1), (x1 := 2, x2 := 3)])
.
When initializing x2
/ node
however, it seem to work i.e. (node := 0, myArr := [(x1 := 0, x2 := 0)])
.
Additional context
This seems like a regression due to 5dac39d