@@ -61,26 +61,30 @@ class __small_buffer {
6161 return *std::launder (reinterpret_cast <_Stored**>(__buffer_));
6262 }
6363
64- # ifdef _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
6564 template <class _Stored >
6665 _LIBCPP_HIDE_FROM_ABI _Stored* __alloc () {
6766 if constexpr (__fits_in_buffer<_Stored>) {
6867 return std::launder (reinterpret_cast <_Stored*>(__buffer_));
6968 } else {
69+ # ifdef _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
7070 byte* __allocation = static_cast <byte*>(::operator new [](sizeof (_Stored), align_val_t {alignof (_Stored)}));
7171 std::construct_at (reinterpret_cast <byte**>(__buffer_), __allocation);
7272 return std::launder (reinterpret_cast <_Stored*>(__allocation));
73+ # else
74+ return static_cast <_Stored*>(std::__libcpp_allocate (_BufferSize* sizeof (byte), _LIBCPP_ALIGNOF (byte)));
75+ # endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
7376 }
7477 }
7578
76- # endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
77- # ifdef _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
7879 template <class _Stored >
7980 _LIBCPP_HIDE_FROM_ABI void __dealloc () noexcept {
8081 if constexpr (!__fits_in_buffer<_Stored>)
82+ # ifdef _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
8183 ::operator delete[] (*reinterpret_cast <void **>(__buffer_), sizeof (_Stored), align_val_t {alignof (_Stored)});
82- }
84+ # else
85+ std::__libcpp_deallocate ((void *)__buffer_, _BufferSize * sizeof (byte), _LIBCPP_ALIGNOF (_Stored));
8386# endif // _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
87+ }
8488
8589 template <class _Stored , class ... _Args>
8690 _LIBCPP_HIDE_FROM_ABI void __construct (_Args&&... __args) {
0 commit comments