Skip to content

Take owning reference to state before allowing to put a new one #3

@Makcal

Description

@Makcal
// before
stateProxy.put(std::move(state.previousState)); // UB, construct from dangling reference
// after
stateProxy.take(std::move(state)).put(std::move(state.previousState)); // still UB, but clang-tidy can detect use-after-move

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions