This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/51538] std::set::insert(InputIterator first, InputIterator last) makes set uniterable


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]