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 {