How can we initialize a queue of structure with replication when non-replicated elements are also present? I tried out below ways without success. Is it even possible?
typedef struct {
A a;
B b;
C c;
D d;
} lp_s; //A,B,C,D : integer enums
lp_s var_name[$] = '{
'{a: A_VAL0, b: B_VAL1, default:0}
'{15{'{a: A_VAL1, b: B_VAL1, default:0}}},
'{a: A_VAL2, b: B_VAL2, default:0}
};
Error here is :
Assignment pattern is illegal due to: Replication field exceeds the size of the target
I removed the tick from replication.
lp_s var_name[$] = '{
'{a: A_VAL0, b: B_VAL1, default:0}
{15{'{a: A_VAL1, b: B_VAL1, default:0}}},
'{a: A_VAL2, b: B_VAL2, default:0}
};
Then error became:
Unpacked Structure of type 'lp_s' can't be assigned by multiple
concatenation operator {15 {'{a: A_VAL1, b: B_VAL1, default:0}}}
However assignment pattern can be assigned to unpacked structures. Add a ' before concatenation operator to convert it to a valid assignment pattern.
Or is there a way to achieve using unpacked array concatenation?