libcxx-compat: fix llvmorg-21-init-18351-gfcc09b6f0267:

[libc++] Fix std::make_exception_ptr interaction with ObjC (#135386)

  Clang treats throwing/catching ObjC types differently from C++ types,
  and omitting the `throw` in `std::make_exception_ptr` breaks ObjC
  invariants about how types are thrown/caught.

  Fixes #135089

  Co-authored-by: Louis Dionne <ldionne.2@gmail.com>

Only use lambdas when in !defined(_LIBCPP_CXX03_LANG), so this will
compile with clang 18 and lower, in C++03 mode and earlier.

PR:		292067
MFC after:	1 month
This commit is contained in:
Dimitry Andric
2026-01-05 21:31:45 +01:00
committed by Dimitry Andric
parent 5465db314a
commit 987ac31018
@@ -93,7 +93,7 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
};
# if _LIBCPP_HAS_EXCEPTIONS
# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && !defined(_LIBCPP_CXX03_LANG)
template <class _Ep>
_LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep& __e) _NOEXCEPT {
using _Ep2 = __decay_t<_Ep>;