-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Summary
The type-erased operation state it movable, which can cause issues if someone forgets to mark their operation state as immovable. In this case, it can be stored in the inline storage, and if anyone takes a pointer to it, it may become invalidated by moving the object.
Reproduction Steps
- Declare a di::AnyOperationState variable
- Move construct it into another variable
- Observe that this isn't a compilation error
Possible causes
The main reason for this problem was that the type-erased connect() function requires NRVO to stop moves. Since this isn't guaranteed by the standard, AnyOperationState has to be move-constructible.
This can be fixed by performing two-phase initialization in the connect() overload, which would then allow the type-erased operation state to be immovable. Then, we should make sure every operation state defined in the library is immovable, since receivers frequently store pointers back to them.
Metadata
Metadata
Assignees
Labels
Projects
Status