http://d.puremagic.com/issues/show_bug.cgi?id=3522


bearophile_h...@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_h...@eml.cc


--- Comment #2 from bearophile_h...@eml.cc 2010-04-29 02:28:23 PDT ---
> The error message is confusing (this is bug 3817), for all of them should be
> something like:
> Should be "Array operation %s not implemented (requires memory allocation)"

I don't understand.

In a program like:

void main() {
    int[] a1 = [1];
    int[] a2 = [2];
    int[] a3;
    a3 = a1 + a2;
}

I think the compiler has to write an error message like:
test.d(5): Error: Array operator + not supported (have you forgotten the []?)

So this is more correct code:

void main() {
    int[] a1 = [1];
    int[] a2 = [2];
    int[] a3;
    a3[] = a1[] + a2[];
}

But array ops don't allocate memory, so the a3 array can't be filled. This
prints nothing:

import std.stdio: writeln;
void main() {
    int[] a1 = [1];
    int[] a2 = [2];
    int[] a3;
    a3[] = a1[] + a2[];
    writeln(a3);
}

This other error can be found at runtime...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to