Skip to content

Commit 89e73e1

Browse files
committed
Fix incorrect rc<T> destruction
1 parent 87bc96c commit 89e73e1

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

modules/strong_ptr.cppm

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,7 @@ struct rc
284284
if (p_object != nullptr) {
285285
// Cast back into the original rc<T> type and ...
286286
auto const* obj = static_cast<rc<T> const*>(p_object);
287-
// Destruct T.
288-
obj->m_object.~T();
289-
// Destructor ref_info if its not trivially destructible. In general, this
290-
// should never be the case, but if we do modify ref_info to have a
291-
// non-trivial destructor, this will automatically manage that.
292-
if constexpr (not std::is_trivially_destructible_v<ref_info>) {
293-
obj->m_info.~ref_info();
294-
}
287+
obj->~rc<T>();
295288
}
296289
// Return size for future deallocation
297290
return sizeof(rc<T>);

0 commit comments

Comments
 (0)