Comment #0 by bearophile_hugs — 2012-02-05T11:11:58Z
This is derived from issue 3971 see there for more (messy) discussions.
Compiling this program:
void main() {
int[2] a;
int[2] b[] = a[];
}
Gives with DMD 2.058head:
test.d(3): Error: cannot implicitly convert expression (a[]) of type int[] to int[2u][]
An alias doesn't solve the problem:
alias double[3] Tri;
void main() {
Tri a = [1, 2, 3];
Tri b = [10, 20, 30];
Tri c[] = a[] - b[];
}
test.d(5): Error: cannot implicitly convert expression (a[] - b[]) of type double[] to double[3u][]
auto with [] doesn't help:
void main() {
int[] a = new int[3];
int[] b = new int[3];
auto c[] = a[] + b[];
}
test.d(4): no identifier for declarator c[]
auto without [] doesn't help:
void main() {
int[] a = new int[3];
int[] b = new int[3];
auto c = a[] + b[];
}
test.d(4): Error: Array operation a[] + b[] not implemented
(Also note the wrong error message, now the + array op is implemented in DMD.)
See also issue 4580
Comment #1 by maxhaton — 2021-01-24T07:06:14Z
Combination of language changes (DIP) and things that work/are-invalid now