diff options
Diffstat (limited to 'libcxx/include/any')
| -rw-r--r-- | libcxx/include/any | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libcxx/include/any b/libcxx/include/any index 03d694edf2c..6f742cbdf73 100644 --- a/libcxx/include/any +++ b/libcxx/include/any @@ -102,6 +102,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER > 14 +_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE +void __throw_bad_any_cast() +{ +#ifndef _LIBCPP_NO_EXCEPTIONS + throw bad_any_cast(); +#else + _VSTD::abort(); +#endif +} + // Forward declarations class _LIBCPP_TYPE_VIS_ONLY any; @@ -579,7 +589,7 @@ _ValueType any_cast(any const & __v) using _Tp = add_const_t<remove_reference_t<_ValueType>>; _Tp * __tmp = _VSTD::any_cast<_Tp>(&__v); if (__tmp == nullptr) - __libcpp_throw(bad_any_cast()); + __throw_bad_any_cast(); return *__tmp; } @@ -594,7 +604,7 @@ _ValueType any_cast(any & __v) typedef typename remove_reference<_ValueType>::type _Tp; _Tp * __tmp = _VSTD::any_cast<_Tp>(&__v); if (__tmp == nullptr) - __libcpp_throw(bad_any_cast()); + __throw_bad_any_cast(); return *__tmp; } @@ -614,7 +624,7 @@ _ValueType any_cast(any && __v) >; _Tp * __tmp = _VSTD::any_cast<_Tp>(&__v); if (__tmp == nullptr) - __libcpp_throw(bad_any_cast()); + __throw_bad_any_cast(); return _VSTD::forward<_ForwardTp>(*__tmp); } |

