This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/12000] New: incorrect default allocator for std::vector class template
- From: "boris at kolpackov dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Aug 2003 23:40:08 -0000
- Subject: [Bug libstdc++/12000] New: incorrect default allocator for std::vector class template
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12000
Summary: incorrect default allocator for std::vector class
template
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: boris at kolpackov dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-gnu-linux
GCC host triplet: i386-gnu-linux
GCC target triplet: i386-gnu-linux
$ cat >vector_and_new.cpp
#include <vector>
#include <iostream>
using std::cerr;
using std::endl;
void*
operator new (std::size_t size) throw (std::bad_alloc)
{
cerr << "new" << endl;
return malloc (size);
}
void
operator delete (void* p) throw ()
{
cerr << "delete " << endl;
free (p);
}
int
main ()
{
int* pi = new int;
delete pi;
std::vector<int> (1);
}
$ g++ --version
g++ (GCC) 3.3 (Debian)
$ g++ ./vector_and_new.cpp
$ ./a.out
new
delete
new
$
-------------------------
I believe this program should (at least) either print
new
delete
-or-
new
delete
new
delete