Error: xxx is not an lvalue

Steven Schveighoffer schveiguy at yahoo.com
Mon May 4 05:42:05 PDT 2009


On Sun, 03 May 2009 05:25:09 -0400, Unknown W. Brackets  
<unknown at simplemachines.org> wrote:

> This code works fine (D 2.x only):
>
> class Test
> {
>    private int[int] _testMap;
>    public ref int[int] testMap() {return _testMap;}
> }
>
> void main()
> {
>    Test test = new Test();
>    test.testMap[0] = 1;
> }
>
> Note the "ref".  Otherwise, a value is returned which is not modifiable.  
>   This will also fix test.array.length.  Nothing wrong here, no creepy  
> bad temporary property problems.

The original code should work, this is a problem.  An AA is not a value  
type.

-Steve



More information about the Digitalmars-d mailing list