[libcxx-commits] [libcxx] [libc++] fix std::make_exception_ptr interaction with ObjC (PR #135386)

James Y Knight via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 16 00:16:16 PDT 2025


jyknight wrote:

It's not great to condition only on `__OBJC__` preprocessor define, since that'll create a potential ODR issue for std::make_exception_ptr on a C++ type, when you're mixing a TU built with C++ and another TU built with ObjC++ in the same program (which, everyone is).

If you switch to the `throw` impl only for ObjC object-pointers, that stops being a problem, as an ObjC object pointer type cannot exist in a non-ObjC++ TU.

As a refinement to my suggestion on the issue, I think `std::is_pointer_v<_Ep> && std::is_convertible_v<_Ep, id>` would be better (so as to not accidentally trigger on a C++ value with a user-defined conversion `operator id()`).

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


More information about the libcxx-commits mailing list