View mode: basic / threaded / horizontal-split · Log in · Help
August 02, 2009
rvalues as ref arguments (as seen in digitalmars.D.learn)
Sorry, moved this discussion from the learn newsgroup, because after discussions it seems important enough.
This code doesn't work in DMD 1.046 anymore (I think it may work in DMD 1.045 and it works for sure in DMD 1.042):

struct V {
   int x;
   V opAdd(V v) { return V.init; }
}
void foo(ref V v) {}
void main() {
   foo(V.init + V.init);
}

On IRC the gentle Daniel Keep has told me this seems an undocumented change. Both LDC and my code may need to change a bit for this.
On IRC, in another channel, Lindquist has expressed other thoughts on the topic.

Bye,
bearophile
August 02, 2009
Re: rvalues as ref arguments (as seen in digitalmars.D.learn)
On Sun, Aug 2, 2009 at 11:06 AM, bearophile<bearophileHUGS@lycos.com> wrote:
> Sorry, moved this discussion from the learn newsgroup, because after discussions it seems important enough.
> This code doesn't work in DMD 1.046 anymore (I think it may work in DMD 1.045 and it works for sure in DMD 1.042):
>
> struct V {
>    int x;
>    V opAdd(V v) { return V.init; }
> }
> void foo(ref V v) {}
> void main() {
>    foo(V.init + V.init);
> }
>
> On IRC the gentle Daniel Keep has told me this seems an undocumented change. Both LDC and my code may need to change a bit for this.
> On IRC, in another channel, Lindquist has expressed other thoughts on the topic.
>
> Bye,
> bearophile

And I already replied on the other group: it's been reported.

http://d.puremagic.com/issues/show_bug.cgi?id=3167
Top | Discussion index | About this forum | D home