[Issue 10424] array operations accept rvalues on the lhs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 21 08:58:49 PDT 2013


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



--- Comment #3 from Nils <nilsbossung at googlemail.com> 2013-06-21 08:58:48 PDT ---
(In reply to comment #2)
> The line is correct D code. g() returns an rvalue int[] array, but the
> assignment is element-wise, and elements of array are always lvalue.
> Then, there's no meaningless rvalue modification.

You're right. I over-simplified the test-case. The actual problem involved
fixed-sized arrays:

struct P
{
    int[2] _data;
    int[2] data() {return _data;}
}
void main()
{
    P p;
    p.data[] = [42, 42]; /* would be neat if this threw a "not an lvalue" error
*/
    p.data[0] = 42; /* ditto */
}

So the issue is that the elements of rvalue fixed-sized arrays are treated as
lvalues. Should I file a new bug for that?

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


More information about the Digitalmars-d-bugs mailing list