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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #9)
> diff --git a/gcc/vec.h b/gcc/vec.h
> index d73d865cff2..c0e577893a3 100644
> --- a/gcc/vec.h
> +++ b/gcc/vec.h
> @@ -1546,7 +1546,12 @@ public:
>        this->m_vec = r.m_vec;
>        r.m_vec = NULL;
>      }
> -  void operator= (auto_vec&&) = delete;
> +  void operator= (auto_vec&& r)
> +    {
> +      this->release ();
> +      this->m_vec = r.m_vec;
> +      r.m_vec = NULL;
> +    }
>  };
>  
>  
> 
> works for the vec.c test, Tom - can you check if it works for nvptx?

Assignment operators should return a reference to *this, not void.

Don't break conventions without good reason.

I suggest adding move assignment *and* swap. Then swap(v1, v2) can be more
efficient than the generic std::swap(v1, v2) by swapping directly, instead of
move-constructing a temporary and then assigning twice.

Reply via email to