[Bug libstdc++/51538] std::set::insert(InputIterator first, InputIterator last) makes set uniterable
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 14 02:07:00 GMT 2011
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;
More information about the Gcc-bugs
mailing list