opAssign and references

Nicolas Silva nical.silva at gmail.com
Tue Jan 31 16:14:38 PST 2012


Oh, my bad, sorry, when I tried the code i showed in the other mail, I
had forgotten the parenthesis on the call to refA() (like if it was an
attribute).

Once fixed it works for me.

f1.refA() = 24; //ok
f1.refA = 24; //not ok, my mistake


On Tue, Jan 31, 2012 at 11:43 PM, Trass3r <un at known.com> wrote:
>> I am using DMD 2.057 on Ubuntu 64bit. Are you sure that it does not work?
>> Can anyone reproduce the error?
>>
>> import std.variant;
>> struct Foo {
>>     Variant a;
>>     ref Variant refA(){
>>         return a;
>>     }
>> }
>> void main(){
>>     Foo f1;
>>     f1.refA() = 24;
>> }
>
>
> Compiles fine on Ubuntu x64 with git dmd and -m(32|64)


More information about the Digitalmars-d-learn mailing list