In the code below:
struct A { int x; }
struct B { int y; }
A[] bufa;
B[] bufb;
bufa[0] = bufb[0];
The error message is "cannot implicitly convert expression `bufb[0]` of type `B` to `A`"
Trying to do a slice assignment:
bufa[] = bufb[];
will render another error message:
"cannot implicitly convert expression `bufb[]` of type `B[]` to `A[]".
Since the root cause is the first one, I think the error message must also state that 'B' si not implicitily convertible to 'A' instead of highlight that sorresponding slices are incompatible.
This example is simple, but if A and B are some long names (e.g. template instantiations), the error message is difficult to gasp and makes you think that is a problem with slice assignment, not with the basic assignment of B to A.
Comment #1 by robert.schadek — 2024-12-13T19:19:50Z