I feel I should mention a detail I observed. I am working on a library which generates D code from C++ code with wrappers. I found an interesting situation when I realised that I need to do something like this.

void setPosition(ref const(QPoint) point) {
     ...
     // Static array.
     auto stack = smokeStack(&point);

     cls.classFn(..., stack.ptr);
     ...
}

The above resulting in passing a pointer to a D struct which gets a reinterpret_cast on the C++ end and copied from that after that. Because I wish to also allow temporaries for this for obvious reasons, I must change my function signature to a template.

void setPosition()(auto ref const(QPointF) point);

So whatever happens with rvalue references, I would like to see the ability to take the address of an rvalue reference in a completely unsafe manner. (Or is const& an lvalue? I have forgetten my Scott Meyers knowledge.) I would make this an error in @safe functions, but allowable for @system and @trusted.

Reply via email to