public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] middle-end/97207 - implement move assign for auto_vec<>
@ 2020-09-25 12:51 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2020-09-25 12:51 UTC (permalink / raw)
  To: gcc-patches

This implements the missing move assignment to make std::swap work
on auto_vec<>

Bootstrapped / tesed on x86_64-unknown-linux-gnu, pushed.

Richard.

2020-09-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/97207
	* vec.h (auto_vec<T>::operator=(auto_vec<T>&&)): Implement.
---
 gcc/vec.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/vec.h b/gcc/vec.h
index d73d865cff2..d8c7cdac073 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1546,7 +1546,13 @@ public:
       this->m_vec = r.m_vec;
       r.m_vec = NULL;
     }
-  void operator= (auto_vec&&) = delete;
+  auto_vec& operator= (auto_vec&& r)
+    {
+      this->release ();
+      this->m_vec = r.m_vec;
+      r.m_vec = NULL;
+      return *this;
+    }
 };
 
 
-- 
2.26.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-25 12:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 12:51 [PATCH] middle-end/97207 - implement move assign for auto_vec<> Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).