diff --git a/libcxx/include/memory b/libcxx/include/memory --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -2641,7 +2641,11 @@ _LIBCPP_INLINE_VISIBILITY - ~unique_ptr() { reset(); } + ~unique_ptr() { + const pointer ptr = __ptr_.first(); + if (ptr) + __ptr_.second()(ptr); + } _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT { @@ -2864,7 +2868,11 @@ public: _LIBCPP_INLINE_VISIBILITY - ~unique_ptr() { reset(); } + ~unique_ptr() { + const pointer ptr = __ptr_.first(); + if (ptr) + __ptr_.second()(ptr); + } _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT {