Skip to content

Commit af06112

Browse files
committed
Correct previous simplification in __small_buffer::__alloc()
1 parent 315a922 commit af06112

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libcxx/include/__utility/small_buffer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ class __small_buffer {
6666
if constexpr (__fits_in_buffer<_Stored>) {
6767
return std::launder(reinterpret_cast<_Stored*>(__buffer_));
6868
} else {
69-
return static_cast<_Stored*>(std::__libcpp_allocate(_BufferSize * sizeof(byte), alignof(_Stored)));
69+
byte* __allocation = static_cast<byte*>(std::__libcpp_allocate(sizeof(_Stored), alignof(_Stored)));
70+
std::construct_at(reinterpret_cast<byte**>(__buffer_), __allocation);
71+
return std::launder(reinterpret_cast<_Stored*>(__allocation));
7072
}
7173
}
7274

0 commit comments

Comments
 (0)