Skip to content

Commit ef73533

Browse files
authored
[z/OS][libc++] Remove align_val_t dependency in small_buffer.h (llvm#114396)
Rewriting `__alloc()` and `__dealloc()` template functions to avoid errors when `small_buffer.h` is included in the modules LIT tests. For example: ``` test-suite-install/include/c++/v1/__utility/small_buffer.h:69:81: error: use of undeclared identifier 'align_val_t' # | 69 | byte* __allocation = static_cast<byte*>(::operator new[](sizeof(_Stored), align_val_t{alignof(_Stored)})); # | | ^ ```
1 parent 22b4b1a commit ef73533

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libcxx/include/__utility/small_buffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class __small_buffer {
6666
if constexpr (__fits_in_buffer<_Stored>) {
6767
return std::launder(reinterpret_cast<_Stored*>(__buffer_));
6868
} else {
69-
byte* __allocation = static_cast<byte*>(::operator new[](sizeof(_Stored), align_val_t{alignof(_Stored)}));
69+
byte* __allocation = static_cast<byte*>(std::__libcpp_allocate(sizeof(_Stored), alignof(_Stored)));
7070
std::construct_at(reinterpret_cast<byte**>(__buffer_), __allocation);
7171
return std::launder(reinterpret_cast<_Stored*>(__allocation));
7272
}
@@ -75,7 +75,7 @@ class __small_buffer {
7575
template <class _Stored>
7676
_LIBCPP_HIDE_FROM_ABI void __dealloc() noexcept {
7777
if constexpr (!__fits_in_buffer<_Stored>)
78-
::operator delete[](*reinterpret_cast<void**>(__buffer_), sizeof(_Stored), align_val_t{alignof(_Stored)});
78+
std::__libcpp_deallocate(*reinterpret_cast<void**>(__buffer_), sizeof(_Stored), alignof(_Stored));
7979
}
8080

8181
template <class _Stored, class... _Args>

0 commit comments

Comments
 (0)