This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] libstdc++/20150
> If std::allocator<T>::allocate(0) doesn't match operator new(0), that's
> another bug.
Perhaps. Should these behaviors match? There is a certain undeniable bit
of sanity in this suggestion. The standard doesn't give much guidance
here.
However, operator new(0) always results in a call to the underlying
system allocation function of size 1. I don't think this is what we want
for allocator.allocate(0).
Note that allocator.allocate already does an upper-bounds check (for
max_size). It seems the sensible place to do a lower bonds check as well.
> It sounds as if fixing __pool_alloc never to return NULL suffices.
This is also a viable solution, in that it would solve the intra-3.4
issues. For portability between 3.3 and 3.4, we'd just say that there
are shiny new toys to play with, that act differently, and ask people to
deal.
As far as the rest of this, I'll open up a general empty vector
bug/enhancement in a moment after I've had a chance to look at this
behavior in particular.
-benjamin