This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/51538] std::set::insert(InputIterator first, InputIterator last) makes set uniterable
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 14 Dec 2011 02:02:04 +0000
- Subject: [Bug libstdc++/51538] std::set::insert(InputIterator first, InputIterator last) makes set uniterable
- Auto-submitted: auto-generated
- References: <bug-51538-4@http.gcc.gnu.org/bugzilla/>
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;