[libcxx-commits] [libcxx] [z/OS][libc++] Guard to be used only when `align_val_t` is available (PR #114396)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 31 08:32:43 PDT 2024


================
@@ -61,6 +61,7 @@ class __small_buffer {
       return *std::launder(reinterpret_cast<_Stored**>(__buffer_));
   }
 
+#  ifdef _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
----------------
ldionne wrote:

As @frederick-vs-ja mentioned, we should either align the memory manually or maybe just use the unaligned version of `operator new`. As-is, the rest of the code would not even compile since `__alloc()` wouldn't be present.

I believe `__libcpp_allocate` is exactly what we want here, since it handles the fallback to aligned allocation if available.

https://github.com/llvm/llvm-project/pull/114396


More information about the libcxx-commits mailing list