From 35033e4699d3356db509e49cb84962679e5c74f5 Mon Sep 17 00:00:00 2001 From: "Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)" Date: Mon, 22 Jun 2020 11:30:46 +0100 Subject: Check for self-move in every move assignment operator. --- include/llfio/v2.0/symlink_handle.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/llfio/v2.0/symlink_handle.hpp') diff --git a/include/llfio/v2.0/symlink_handle.hpp b/include/llfio/v2.0/symlink_handle.hpp index 8f7e7bb8..39706343 100644 --- a/include/llfio/v2.0/symlink_handle.hpp +++ b/include/llfio/v2.0/symlink_handle.hpp @@ -158,6 +158,10 @@ public: //! Move assignment buffers_type &operator=(buffers_type &&o) noexcept { + if(this == &o) + { + return *this; + } this->~buffers_type(); new(this) buffers_type(std::move(o)); return *this; @@ -221,6 +225,10 @@ public: //! Move assignment const_buffers_type &operator=(const_buffers_type &&o) noexcept { + if(this == &o) + { + return *this; + } this->~const_buffers_type(); new(this) const_buffers_type(std::move(o)); return *this; @@ -320,6 +328,10 @@ public: //! Move assignment permitted symlink_handle &operator=(symlink_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~symlink_handle(); new(this) symlink_handle(std::move(o)); return *this; -- cgit v1.2.3