Open
Conversation
sylveon
reviewed
Mar 23, 2026
sylveon
reviewed
Mar 23, 2026
sylveon
reviewed
Mar 23, 2026
Contributor
Author
|
I found that when running the CI on my own fork, Clang 20 target x86 generated incorrect code, causing the test to fail. The characteristic of this bug is that in the constructor of observed_sender at L101, |
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.
When using lambda coroutines as delegates, care must be taken that the lifetime of captured objects may be shorter than that of the coroutine, see #766 (comment). This issue has a better solution in C++23, which is to use explicit object parameters to copy the captures into the coroutine frame. However, this feature is currently not available in C++/WinRT.
The following code fails to compile with an error that the copy constructor has been deleted.
The reason is that the final type
delegateinherits from the handler (lambda), and code_writers.h#L2619 uses the typedelegate(*thisin theInvokemember function ofdelegate) to calloperator(), causingthis(explicit parameter of lambda) to be deduced asdelegate. Sincedelegateis non-copyable,operator()cannot be called. This change makesInvokeuse the original lambda's type to calloperator(), sothisis deduced as the lambda's type, resolving the issue.Because of the purpose is to copy the captured object into the coroutine frame, the slicing that occurs here is intentional, and there is no need to copy the complete
delegateobject.