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

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 25 Sep 2020, redi at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97207
> 
> --- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #4)
> > That swap couldn't have worked before because auto_vec eventually contains a
> > pointer into itself.  So the patch has improved things from broken to
> > rejected.  Rejected because while there's a move CTOR now, std::swap isn't
> > happy with just that.
> > 
> > No idea why - Jonathan?
> 
> Because swap requires assignment, not just construction.
> 
> I don't see a libstdc++ bug here.

But there is assignment?  Just no move assignment?  I guess swap
is really special because clearly formerly

 {
  auto_vec<int> a, b;
  a.safe_push (1);
  b = a;
 }

would have caused a double-free.  std::swap fixes this because, well,
it swaps.  Going to try implement move assignment then.

Just wonder why when move assingment is not there it doesn't
fall back to non-move assignment semantics (aka previous behavior)

Reply via email to