-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: Internal Code
-
Service Arch
-
Fully Compatible
-
Service Arch 2023-07-10, Service Arch 2023-07-24, Service Arch 2023-08-07
I was helping diagnose a confusing situation yesterday where someone had something like this:
AsyncTry([] { return SomeMoveOnlyType(); }) .until([] (StatusWith<SomeMoveOnlyType> swType) { return false; }) .on(executor, CancelationToken::uncancelable());
It fails to compile because the lambda passed to 'until' is called with an lvalue, so it tries to copy the move-only type and fails to. Furthermore, it has to pass it as an lvalue because it still needs to use it later, so moving it into the condition isn't an option.
These compiler errors are kind of cryptic. If we added a static assertion to ensure that the condition passed to 'until' had to take a const ref, then we could avoid this situation by emitting an easy to diagnose compiler error.