Fix moving a final_act twice

This commit is contained in:
Treb Connell 2015-10-02 15:58:23 -07:00
parent df88352c1d
commit b8ec73a179
2 changed files with 8 additions and 3 deletions

View File

@ -80,7 +80,7 @@ class final_act
public: public:
explicit final_act(F f) noexcept : f_(std::move(f)), invoke_(true) {} explicit final_act(F f) noexcept : f_(std::move(f)), invoke_(true) {}
final_act(final_act&& other) noexcept : f_(std::move(other.f_)), invoke_(true) { other.invoke_ = false; } final_act(final_act&& other) noexcept : f_(std::move(other.f_)), invoke_(other.invoke_) { other.invoke_ = false; }
final_act(const final_act&) = delete; final_act(const final_act&) = delete;
final_act& operator=(const final_act&) = delete; final_act& operator=(const final_act&) = delete;

View File

@ -47,6 +47,11 @@ SUITE(utils_tests)
CHECK(i == 0); CHECK(i == 0);
} }
CHECK(i == 1); CHECK(i == 1);
{
auto _2 = std::move(_1);
CHECK(i == 1);
}
CHECK(i == 1);
} }
CHECK(i == 1); CHECK(i == 1);
} }