- edited description
- changed title to Accept LPC function object callbacks that can only be invoked by rvalue
Accept LPC function object callbacks that can only be invoked by rvalue
It's currently underspecified whether various UPC++ callbacks into user code will accept a function object that can only be invoked by rvalue, eg:
#include <upcxx/upcxx.hpp>
#include <iostream>
#include "util.hpp"
struct MyFn {
void operator()() && { // <- note the && here
say() << "Tada";
}
};
int main() {
upcxx::init();
upcxx::current_persona().lpc(MyFn()).wait(); // obscure compile error
upcxx::finalize();
return 0;
}
Colin noticed this particular case (round-trip LPC) happens to currently generate a compile error, a behavior dating back to at least release 2021.3.0.
However such function objects ARE correctly handled by a number of other callback interfaces in UPC++.
I'm not sure we want to go so far as to mandate behavior for this unusual corner-case in the specification, but as a quality-of-implementation feature it would be nice to support such function objects in places where it doesn't entail significant additional effort.
Comments (3)
-
reporter -
reporter - changed status to open
Proposed resolution:
-
reporter - changed status to resolved
issue 609: Accept LPC function object callbacks that can only be invoked by rvalue
Resolves issue
#609→ <<cset dc8b47404dd6>>
- Log in to comment