Re: opAssign and references

2012-02-01 Thread sclytrack
On 02/01/2012 07:15 AM, Simen Kjærås wrote: On Wed, 01 Feb 2012 01:14:38 +0100, Nicolas Silva wrote: 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()

Re: opAssign and references

2012-01-31 Thread Simen Kjærås
On Wed, 01 Feb 2012 01:14:38 +0100, Nicolas Silva wrote: 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 mist

Re: opAssign and references

2012-01-31 Thread Nicolas Silva
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 wrote: >> I am

Re: opAssign and references

2012-01-31 Thread Trass3r
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

Re: opAssign and references

2012-01-31 Thread Timon Gehr
On 01/31/2012 06:15 PM, Nicolas Silva wrote: Hi, Works for me. Which version of the compiler are you using? Sorry, i forgot to mention: i'm using dmd 2.057 on ubuntu 32bit. I am using DMD 2.057 on Ubuntu 64bit. Are you sure that it does not work? Can anyone reproduce the error? import s

Re: opAssign and references

2012-01-31 Thread Nicolas Silva
Hi, > Works for me. Which version of the compiler are you using? Sorry, i forgot to mention: i'm using dmd 2.057 on ubuntu 32bit. On Tue, Jan 31, 2012 at 5:31 PM, Timon Gehr wrote: > On 01/31/2012 03:03 PM, Nicolas Silva wrote: >> >> Hi, >> >> I'm playing with variants and I noticed that opAss

Re: opAssign and references

2012-01-31 Thread Timon Gehr
On 01/31/2012 03:03 PM, Nicolas Silva wrote: Hi, I'm playing with variants and I noticed that opAssign is not invoked when an assignation is done on a reference. here is the test case: import std.variant; struct Foo { Variant a; Variant b; ref Variant refA() { ret