Skip to content

Commit a83b5ca

Browse files
committed
Guard to be used only when they are available
1 parent 21a6032 commit a83b5ca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libcxx/include/__utility/small_buffer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class __small_buffer {
6161
return *std::launder(reinterpret_cast<_Stored**>(__buffer_));
6262
}
6363

64+
# ifdef _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
6465
template <class _Stored>
6566
_LIBCPP_HIDE_FROM_ABI _Stored* __alloc() {
6667
if constexpr (__fits_in_buffer<_Stored>) {
@@ -72,11 +73,14 @@ class __small_buffer {
7273
}
7374
}
7475

76+
# endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
77+
# ifdef _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
7578
template <class _Stored>
7679
_LIBCPP_HIDE_FROM_ABI void __dealloc() noexcept {
7780
if constexpr (!__fits_in_buffer<_Stored>)
7881
::operator delete[](*reinterpret_cast<void**>(__buffer_), sizeof(_Stored), align_val_t{alignof(_Stored)});
7982
}
83+
# endif // _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
8084

8185
template <class _Stored, class... _Args>
8286
_LIBCPP_HIDE_FROM_ABI void __construct(_Args&&... __args) {

0 commit comments

Comments
 (0)