Conversation
QCoro::detail::QCoroSignal is not a copy-constructible class (it contains std::unique_ptr), but when calling co_await, gcc tried to make a copy of coroSignal either when evaluating the expression after `co_await`, or when passing the result of the expression to `Task<T>::await_transform()`. This is despite Task::await_transform() having an overload that accepts reference or an lvalue reference to the object. I do believe this might be a regression in gcc 11.3, since it worked in gcc 11.2 and it works with clang as well. The C++ standard does not specify any constraints regarding how the result of the expression after the co_await keyword should be passed to `await_transform`. As a workaround, we co_await a temporary QCoroSignal, which gcc seems to correctly pass down as a lvalue reference, so no issues with copying. Explictly `std::move()`ing `coroSignal` to `co_await` would also work, but it's weird. I haven't confirmed whether this is a bug yet, as I first need to put together a small reproducer case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
QCoro::detail::QCoroSignal is not a copy-constructible class
(it contains std::unique_ptr), but when calling co_await,
gcc tried to make a copy of coroSignal either when evaluating
the expression after
co_await, or when passing the result ofthe expression to
Task<T>::await_transform(). This is despiteTask::await_transform() having an overload that accepts reference
or an lvalue reference to the object.
I do believe this might be a regression in gcc 11.3, since it worked
in gcc 11.2 and it works with clang as well. The C++ standard does
not specify any constraints regarding how the result of the expression
after the co_await keyword should be passed to
await_transform.As a workaround, we co_await a temporary QCoroSignal, which gcc seems
to correctly pass down as a lvalue reference, so no issues with copying.
Explictly
std::move()ingcoroSignaltoco_awaitwould also work,but it's weird.
I haven't confirmed whether this is a bug yet, as I first need to put
together a small reproducer case.