[libcxx-commits] [PATCH] D93130: [libc++] Refactor allocate_shared to use an allocation guard

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 15 08:50:43 PST 2020


ldionne added a comment.

In D93130#2455196 <https://reviews.llvm.org/D93130#2455196>, @saugustine wrote:

> In D93130#2455145 <https://reviews.llvm.org/D93130#2455145>, @ldionne wrote:
>
>> In D93130#2453963 <https://reviews.llvm.org/D93130#2453963>, @saugustine wrote:
>>
>>> This change appears to have dropped a constructor, or maybe two. I'm not familiar enough with all the requirements to know if that is correct or not. Here is a somewhat redacted version of the errors I get building a private application.
>>> ...
>>
>> Is it possible that your custom `Allocator` has its converting copy constructor (from other specializations of `Allocator`) marked as `explicit`? We don't seem to have a test for that, I'll add one and fix this, but please confirm that it's the case.
>
> Yes, in fact it does. Thanks for the quick follow up.

Ok, that was it. Fixed by:

  commit a00290ed10a6b4e9f6e9be44ceec367562f270c6 (HEAD -> main, github-llvm/main)
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   Tue Dec 15 11:45:53 2020 -0500
  
      [libc++] Fix allocate_shared when used with an explicitly convertible allocator
  
      When the allocator is only explicitly convertible from other specializations
      of itself, the new version of std::allocate_shared would not work because
      it would try to do an implicit conversion. This patch fixes the problem
      and adds a test so that we don't fall into the same trap in the future.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93130/new/

https://reviews.llvm.org/D93130



More information about the libcxx-commits mailing list