[libcxx-commits] [PATCH] D110846: [libcxx] Make allocator<T>:allocate throw bad_array_new_length

Mikhail Maltsev via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 4 03:20:56 PDT 2021


miyuki added inline comments.


================
Comment at: libcxx/include/new:151
 _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc();  // not in C++ spec
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __libcpp_throw_bad_array_new_length();
 
----------------
ldionne wrote:
> For consistency?
The function `__throw_bad_array_new_length` is implemented in libstdc++, so it doesn't get defined when using libsupc++ as the ABI library. There is no `__throw_bad_array_new_length function` in libstdc++, but I thought that this might change in the future, so I named the function differently to avoid possible name clash.

But now I noticed that there is a `__cxa_throw_bad_array_new_length` function which is part of the Itanium ABI and is implemented in both libc++abi and libsupc++ (introduced in CXXABI_1.3.8, GCC 4.9). Should I use it instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110846



More information about the libcxx-commits mailing list