[libc-commits] [libc] [libc] Export the RPC interface from `libc` (PR #71432)

Jon Chesterfield via libc-commits libc-commits at lists.llvm.org
Tue Mar 19 06:24:08 PDT 2024


================
@@ -25,12 +25,14 @@ namespace LIBC_NAMESPACE::cpp {
 #define LLVM_LIBC_HAS_BUILTIN_MEMCPY_INLINE
 #endif
 
-// This implementation of bit_cast requires trivially-constructible To, to avoid
-// UB in the implementation.
 template <typename To, typename From>
 LIBC_INLINE constexpr cpp::enable_if_t<
     (sizeof(To) == sizeof(From)) &&
+// Implementation of bit_cast that cannot use the compiler builtin must be
+// trivially-constructible To, to avoid UB in the implementation.
+#if !LIBC_HAS_BUILTIN(__builtin_bit_cast)
----------------
JonChesterfield wrote:

I don't see why this would be the case - even if we had to DIY a bitcast from scratch, wouldn't default constructible suffice?

Also aren't these things all trivially constructible anyway, in which case I don't know why there's an `#if` around this 

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


More information about the libc-commits mailing list