[llvm-branch-commits] [libcxx] release/23.x: [libcxx][NFC] Address -Wmicrosoft-cast in MSVC's exception_ptr (#210570) (PR #210765)
Douglas Yung via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jul 22 06:56:19 PDT 2026
https://github.com/dyung updated https://github.com/llvm/llvm-project/pull/210765
>From 881e1cb71911cdce060845310a4c5aaa46b48324 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Sun, 19 Jul 2026 17:47:01 -0700
Subject: [PATCH] [libcxx][NFC] Address -Wmicrosoft-cast in MSVC's
exception_ptr (#210570)
This was introduced as part of #94977. Rather than suppressing the
warning with `#pragma clang diagnostic ignored`, we use
`reinterpret_cast` to avoid the implicit conversion.
(cherry picked from commit 16ffd27e3737c01cbabad6eed77b919dc977ad6c)
---
libcxx/src/support/runtime/exception_pointer_msvc.ipp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libcxx/src/support/runtime/exception_pointer_msvc.ipp b/libcxx/src/support/runtime/exception_pointer_msvc.ipp
index 3102d1ee93db2..4b877deeec7bc 100644
--- a/libcxx/src/support/runtime/exception_pointer_msvc.ipp
+++ b/libcxx/src/support/runtime/exception_pointer_msvc.ipp
@@ -141,7 +141,7 @@ void __copy_exception_object(void* __dest, const void* __src, const CatchableTyp
#if _EH_RELATIVE_TYPEINFO
const auto __copy_func = reinterpret_cast<void*>(__throw_image_base + __type->copyFunction);
#else // _EH_RELATIVE_TYPEINFO
- const auto __copy_func = __type->copyFunction;
+ const auto __copy_func = reinterpret_cast<void*>(__type->copyFunction);
#endif // _EH_RELATIVE_TYPEINFO
const auto __adjusted = __AdjustPointer(const_cast<void*>(__src), __type->thisDisplacement);
@@ -204,7 +204,8 @@ struct alignas(__STDCPP_DEFAULT_NEW_ALIGNMENT__) __exception_ptr_normal final :
__call_member_function_0(__cpp_eh_record.params.pExceptionObject,
reinterpret_cast<void*>(__throw_info->pmfnUnwind + __throw_image_base));
#else // _EH_RELATIVE_TYPEINFO
- __call_member_function_0(__cpp_eh_record.params.pExceptionObject, __throw_info->pmfnUnwind);
+ __call_member_function_0(__cpp_eh_record.params.pExceptionObject,
+ reinterpret_cast<void*>(__throw_info->pmfnUnwind));
#endif // _EH_RELATIVE_TYPEINFO
} else if (__type->properties & CT_IsWinRTHandle) {
const auto* __unknown = *static_cast<IUnknown* const*>(__cpp_eh_record.params.pExceptionObject);
More information about the llvm-branch-commits
mailing list