Skip to content

Fix broken move#9170

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
tfc:fix-broken-move
Oct 16, 2023
Merged

Fix broken move#9170
Ericson2314 merged 1 commit intoNixOS:masterfrom
tfc:fix-broken-move

Conversation

@tfc
Copy link
Contributor

@tfc tfc commented Oct 16, 2023

Motivation

While randomly reading code, i discovered this bug.

Context

A moved-from object in C++ is in valid, but undefined state. This means that you can for example destruct or reassign it, but not use it in any context that has certain assumptions on its content.
The set(...) function uses the emplace method on the moved-from object (which is a map), and that is not allowed in that context before reassigning an empty map.

Priorities

Add 👍 to pull requests you find important.

@tfc tfc requested a review from edolstra as a code owner October 16, 2023 18:35
@Ericson2314 Ericson2314 enabled auto-merge October 16, 2023 18:50
@Ericson2314
Copy link
Member

Thank you!

@Ericson2314 Ericson2314 merged commit aa4f41d into NixOS:master Oct 16, 2023
@tfc tfc deleted the fix-broken-move branch October 16, 2023 19:50
tebowy pushed a commit to tebowy/nix that referenced this pull request Jul 11, 2024
Fix broken move

(cherry picked from commit aa4f41d)
Change-Id: I39d3f9f4f27328500de005c9205d905c55d6f9ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants