[libc-commits] [libc] [libc] Some MSVC compatibility fixes in src/__support. (PR #159428)

via libc-commits libc-commits at lists.llvm.org
Wed Sep 17 12:15:07 PDT 2025


================
@@ -36,7 +37,7 @@ LIBC_INLINE constexpr cpp::enable_if_t<
     To>
 bit_cast(const From &from) {
   MSAN_UNPOISON(&from, sizeof(From));
-#if __has_builtin(__builtin_bit_cast)
+#if __has_builtin(__builtin_bit_cast) || defined(LIBC_COMPILER_IS_MSVC)
----------------
lntue wrote:

We already define `__has_builtin(x) 0` for MSVC https://github.com/llvm/llvm-project/blob/main/libc/src/__support/macros/config.h#L26

The problem here is that MSVC does have `__builtin_bit_cast`.

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


More information about the libc-commits mailing list