summaryrefslogtreecommitdiff
path: root/src/mongo/base/status-inl.h
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2015-08-31 18:40:55 -0400
committerMathias Stearn <mathias@10gen.com>2015-09-18 14:00:07 -0400
commitd38d401f6a11f20023aa2628723976fa993c16b6 (patch)
treeeb1ca736d2fa15c85e7cf2c7b41941fb2da085a4 /src/mongo/base/status-inl.h
parentdd8014ab860189880ba258637e48d2b637de0a5c (diff)
downloadmongo-d38d401f6a11f20023aa2628723976fa993c16b6.tar.gz
SERVER-20233 Custom move assignments must handle self-assignment
On MSVC2013 they must be no-ops. On other platforms they can leave the object in a valid but unspecified state.
Diffstat (limited to 'src/mongo/base/status-inl.h')
-rw-r--r--src/mongo/base/status-inl.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/base/status-inl.h b/src/mongo/base/status-inl.h
index 13209a48e33..a029544ca87 100644
--- a/src/mongo/base/status-inl.h
+++ b/src/mongo/base/status-inl.h
@@ -49,6 +49,11 @@ inline Status::Status(Status&& other) BOOST_NOEXCEPT : _error(other._error) {
}
inline Status& Status::operator=(Status&& other) BOOST_NOEXCEPT {
+#if defined(_MSC_VER) && _MSC_VER < 1900 // MSVC 2013 STL can emit self-move-assign.
+ if (&other == this)
+ return *this;
+#endif
+
unref(_error);
_error = other._error;
other._error = nullptr;