Property assignment problem

SebastianA sebastian.ahlman at remedygames.com
Fri May 11 00:26:49 PDT 2012


On Friday, 11 May 2012 at 07:18:30 UTC, Jonathan M Davis wrote:
> On Friday, May 11, 2012 09:10:37 SebastianA wrote:
>> Okay, thanks for the info. The weird thing is, if I change the
>> line to:
>> 
>> t.vPosition = Vec(2, 2);
>> 
>> it compiles and works, even if the property is ref. As far as I
>> know, this does nothing towards correcting the rvalue issue.
>> Should this also cause an error?
>
> struct literals work. They at least used to be lvalues for some 
> bizarre
> reason. I'm not sure if they are now, because it went back and 
> forth prior to
> the last release. They're either still lvalues or the first 
> part of making
> rvalues work with ref has been implemented (but only with 
> struct literals).
> I'm not sure which.
>
> - Jonathan M Davis

I did this very naive test:

"Vec(2, 2) = Vec(3, 4);"

which gave me the error

"test.d(30): Error: Vec(2,2) is not an lvalue"

so apparently it's not an lvalue, at least not in that sense.

Anyway, thanks for the info. We can probably get around the 
problem by using non-ref parameters for now. It is very weird 
that GDC accepts the code though, and it even works when running 
a debug build.

BR,
Sebastian Ahlman


More information about the Digitalmars-d mailing list