[Bug libstdc++/55409] std::list not properly wrapping access to custom allocator through allocator_traits
potswa at mac dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 17 21:20:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55409
--- Comment #13 from David Krauss <potswa at mac dot com> ---
Nice!
Just a few things:
1. Line 304: rebind isn’t an official member of allocator_traits. Prefer
rebind_alloc.
2. _M_put_node is assuming no fancy pointers: its parameter is a
_Node_alloc_traits::pointer but its argument is a _Node*. I think the intent
with fancy pointers is that they get stored in nodes, but doing so would change
the ABI for fancy pointers that implicitly convert to raw. Perhaps that’s
acceptable, with these sweeping changes?
3. Line 554: should call _Node_alloc_traits::construct. (This breaks allocators
which need a rebind to do construction, but so does the C++11 standard. To be
both backward- and forward-compatible would require rebinding, converting,
constructing via traits, converting back, and assigning. According to my
reading, anyway.) For what it’s worth, the revision already uses
_Node_alloc_traits::destroy, although that’s customized less in practice.
More information about the Gcc-bugs
mailing list