rvalues as ref arguments

bearophile bearophileHUGS at lycos.com
Sun Aug 2 07:51:25 PDT 2009


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.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list