[cfe-dev] [libc++][Bug] Using allocators with std::map
Furkan Usta via cfe-dev
cfe-dev at lists.llvm.org
Sun Aug 7 06:21:28 PDT 2016
I guess, I've found 2 bugs. I am not sure whether I should send this 2
separate mails. It is my first time, sorry about that.
1-) Custom allocator with explicit copy constructor
Here is the non-working code:
http://melpon.org/wandbox/permlink/wPpkYEzt0NrxTbJC
My reasoning is, in map constructor
map(const allocator_type& __a)
: __tree_(__a)
__a is an allocator with std::pair. However, __tree_ is instantiated
with __value_type. It requires copy construction which is explicit.
2-) operator=, propagate_on_container_copy_assignment
Code: http://melpon.org/wandbox/permlink/uPR3u5fYkUx2In4k
propagate_on_container_copy_assignment is true and comparison always
returns false. Thus, it should use this->allocator to deallocate and
other.allocator to allocate.
Although in the example it doesn't even allocate, I guess it is
because there is
some sort of caching system, in the code it does
__copy_assign_alloc(__t);
__assign_multi(__t.begin(), __t.end());
Then caches the nodes to be deleted in __assign_multi, but allocator
already changes
in __copy_assign_alloc
If they are really bugs, should I still open an issue in bugzilla or
is this mail enough?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160807/2a60cd93/attachment.html>
More information about the cfe-dev
mailing list