[cfe-dev] [libc++][Bug] Using allocators with std::map

Marshall Clow via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 15 22:29:14 PDT 2016


On Sun, Aug 7, 2016 at 6:21 AM, Furkan Usta via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> 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?
>
>
> I would appreciate it if you would open them on http://llvm.org/bugs
Thanks!

-- Marshall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160815/e35f04db/attachment.html>


More information about the cfe-dev mailing list