[Bug libstdc++/12000] New: incorrect default allocator for std::vector class template
boris at kolpackov dot net
gcc-bugzilla@gcc.gnu.org
Wed Aug 20 23:40:00 GMT 2003
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
More information about the Gcc-bugs
mailing list