asioexec::completion_token & ::use_sender: Constrain Initiate #1685
+39
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously async_result<asioexec::completion_token, ...>:: and async_result<asioexec::use_sender, ...>::initiate:
This meant that initiating functions of the form were problematic:
Note that:
The latter of the two points above means that the compiler must determine the type of an expression involving async_initiate. Since that expression transitively defers to async_result<...>::initiate this meant that the compiler had to determine the return type thereof. Since (as mentioned above) that function uses automatic return type deduction that meant the compiler had to substitute into the body thereof. Since errors in such a context are not SFINAE-friendly this meant that if the variadic pack of arguments thereto did not consist only of decay- copyable types there would be a hard compilation error (rather than the overload simply being removed from the candidate set).
Both newly-added unit tests failed to compile before this change due to the above.
Added a constraint to both previously-mentioned initiate functions to address the above.