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

Mikhail Maltsev via libcxx-dev libcxx-dev at lists.llvm.org
Wed Sep 29 03:01:58 PDT 2021


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


More information about the libcxx-dev mailing list