https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97207

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, adding explicit swap doesn't look worth the trouble (the object is just a
single pointer).  Might be useful if we ever support std::move for auto_vec<T,
N> with N != 0.  Which reminds me that still uses broken default
implementations.

I am testing the following, sorry for my limited C++ knowledge... (but
seriously I didn't expect a std::swap(auto_vec) user...)

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;
+    }
 };

Reply via email to