Guarantee crash on Result self-move.

GitOrigin-RevId: 64475d63e5ccc3ebac99d21946941b8f5689cfe8
This commit is contained in:
levlam 2019-02-04 07:05:44 +03:00
parent 786adb165d
commit 8687be3f12

View File

@ -343,6 +343,7 @@ class Result {
other.status_ = Status::Error<-2>(); other.status_ = Status::Error<-2>();
} }
Result &operator=(Result &&other) { Result &operator=(Result &&other) {
CHECK(this != &other);
if (status_.is_ok()) { if (status_.is_ok()) {
value_.~T(); value_.~T();
} }