summaryrefslogtreecommitdiffstats
path: root/libcxx/include/memory
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/memory')
-rw-r--r--libcxx/include/memory19
1 files changed, 11 insertions, 8 deletions
diff --git a/libcxx/include/memory b/libcxx/include/memory
index 5cdb60f5e70..7047bc71729 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -637,9 +637,6 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <tuple>
#include <stdexcept>
#include <cstring>
-#if defined(_LIBCPP_NO_EXCEPTIONS)
- #include <cassert>
-#endif
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
@@ -3787,6 +3784,16 @@ public:
virtual const char* what() const _NOEXCEPT;
};
+_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
+void __throw_bad_weak_ptr()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw bad_weak_ptr();
+#else
+ _VSTD::abort();
+#endif
+}
+
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
class _LIBCPP_TYPE_VIS __shared_count
@@ -5443,11 +5450,7 @@ shared_ptr<_Tp>::shared_ptr(const weak_ptr<_Yp>& __r,
__cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_)
{
if (__cntrl_ == 0)
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw bad_weak_ptr();
-#else
- assert(!"bad_weak_ptr");
-#endif
+ __throw_bad_weak_ptr();
}
template<class _Tp>
OpenPOWER on IntegriCloud