Who says you can't bind a temporary to ref, or: why do we need DIP1016 again?

Atila Neves atila.neves at gmail.com
Sat Dec 22 16:26:31 UTC 2018


Fun times:

---------------
void main() {
     Foo foo;
     takesRef(foo.create.i);  // oops
}

struct Foo {
     int i;
     Foo create() {
         return Foo();
     }
}

void takesRef(ref int x) { }
---------------

Even more fun with auto ref:

https://issues.dlang.org/show_bug.cgi?id=19507




More information about the Digitalmars-d mailing list