Skip to content

Commit

Permalink
mir: fix warnings with PerMachine move-constructor
Browse files Browse the repository at this point in the history
This is a legit issue, not only was the target being initialized first,
but both the host and the target values were moving the target field
from the other one. This last part is obviously really bad.
  • Loading branch information
dcbaker committed Oct 16, 2024
1 parent 46411c0 commit f559607
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/mir/meson/machines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ template <typename T> class PerMachine {
: _build{std::move(_b)}, _host{std::move(_h)}, _target{std::nullopt} {};
PerMachine(T && _b) : _build{std::move(_b)}, _host{std::nullopt}, _target{std::nullopt} {};
PerMachine(PerMachine<T> && t) noexcept
: _build{std::move(t._build)}, _target{std::move(t._target)},
_host{std::move(t._target)} {};
: _build{std::move(t._build)}, _host{std::move(t._host)}, _target{std::move(t._target)} {};
~PerMachine() = default;

PerMachine<T> & operator=(PerMachine<T> && t) noexcept {
Expand Down

0 comments on commit f559607

Please sign in to comment.