This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34839] stl vector.resize()/assign() strange behaviour
- From: "pcarlini at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jan 2008 23:21:58 -0000
- Subject: [Bug c++/34839] stl vector.resize()/assign() strange behaviour
- References: <bug-34839-15655@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pcarlini at suse dot de 2008-01-17 23:21 -------
The behavior is correct. First the default constructor is used in resize, then
(you can't see it with the snippet) the copy constructor binds to that default
constructed element, used in 3 placement new; finally the destructor runs on
the default constructed element. Then again default constructor, destructor,
the same, and one additional destructor due to the resize to 2 positions (the
last element is destroyed).
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34839