[libcxx-dev] Why does std::allocator<T>::allocate throw std::length_error?

Louis Dionne via libcxx-dev libcxx-dev at lists.llvm.org
Fri Oct 1 08:09:38 PDT 2021


Yes, a patch would be welcome. We can discuss the ABI implications on the review, but I'm seeing this positively.

Louis

> On Sep 29, 2021, at 06:01, Mikhail Maltsev via libcxx-dev <libcxx-dev at lists.llvm.org> wrote:
> 
> On 9/28/21 8:21 PM, Arthur O'Dwyer wrote:
>> Hi Mikhail,
>> 
>> The following LWG issues are related. This seems to be a maze of twisty little
>> DRs and I'm not surprised libc++ isn't fully up to date.
>> https://cplusplus.github.io/LWG/issue3038
>> <https://cplusplus.github.io/LWG/issue3038>
>> https://cplusplus.github.io/LWG/issue3190
>> <https://cplusplus.github.io/LWG/issue3190>
>> https://cplusplus.github.io/LWG/issue3237
>> <https://cplusplus.github.io/LWG/issue3237>
>> It also would not surprise me if that commit from 2016 was due to a simple mixup
>> of the common (but wrong in this case) "length_error" with the uncommon (but
>> IIUC correct) "bad_array_new_length".
>> However, also notice that that commit comes right after a patch series
>> implementing <experimental/memory_resource>, which /was/ initially specified to
>> throw `length_error` from polymorphic_allocator<T>. LWG3237 fixed it to throw
>> `bad_array_new_length` instead.
>> 
> 
> Thanks for the pointers.
> 
>> Anyway, I'm sure a patch would be welcomed... and then held up for a while as
>> Louis ponders the ABI-break implications. ;)
>> 
> I'll have a look into it.
> 
> -- 
> Regards,
>  Mikhail Maltsev
> _______________________________________________
> libcxx-dev mailing list
> libcxx-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev



More information about the libcxx-dev mailing list