erik.pilkington added a comment.

In https://reviews.llvm.org/D30837#698305, @EricWF wrote:

> We can't just use an arbitrary allocator type for a number of reasons:
>
> - You just changed the type of the control block. That's ABI breaking.


Ah, I didn't think of that. This new patch only selects `allocator<int>` when 
_Yp is a function type, which is only permitted as of this patch.

> - `allocator<int>` allocates ints, nothing else.

Since we only use `allocator<int>` for a rebind, we don't violate this rule.

> - It may mean we don't select a valid user specialization of `allocator<Yp>`.

In the new patch, `allocator<int>` is only selected if `is_function<_Yp>`, I 
don't believe that there is any valid user specialization of 
`std::allocator<FunctionType>`. This is because [namespace.std] p1:

> A program may add a template specialization for any standard library template 
> to namespace std only if [...] the specialization meets the standard library 
> requirements for the original template [...]

In this case, the original template is the default allocator, which is supposed 
to have overloads of `address` taking a `const_reference` and a `reference` 
([allocator.members] p2-3), which will be ambiguous for function types with the 
given definitions of `const_reference` and `reference`. Is this a valid 
argument?


https://reviews.llvm.org/D30837



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to