[Issue 12982] internal error when using array expression as an argument

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 24 07:22:36 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12982

--- Comment #2 from bearophile_hugs at eml.cc ---
This code:


double[] f1(double[] x) {
    double[] result = x.dup;
    result[] = x[] * 3.0;
    return result;
}

void main() {
    import std.stdio;
    double[] a = [1.0, 2.0];
    writeln("a= ", a);
    double[] b = f1(2.0 * a[]);
    writeln("b= ", b);
}

I am not seeing a internal compiler error:

test.d(11): Error: array operation a[] * 2.00000 without assignment not
implemented

But I agree the error message should be improved. So if you want we can turn
this issue in a diagnostic enhancement request.

--


More information about the Digitalmars-d-bugs mailing list