http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51538

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-12-14 
02:02:04 UTC ---
(In reply to comment #3)
> >     const FOOwrapper & operator=(const FOOwrapper & othr)
> >     {
> >         memcpy(&m_uidl, &othr.m_uidl, sizeof(FOO));
> >         return *this;
> >     }
> 
> This assignment operator is unnecessary, the implicit one would do the same
> thing.

Actually the implicit assignment would be safe against self-assignment, but
this isn't because memcpy cannot be called with overlapping regions.

This results in more undefined behaviour:

  FOO f = { } ;
  FOOwrapper w(&f);
  w = w;

Reply via email to