Skip to content

Commit

Permalink
fix(smart_holder): Use std::default_delete. (#4924)
Browse files Browse the repository at this point in the history
Ensures `std::default_delete<T>` is used to look up the deleter for a type instead of `delete` directly.
  • Loading branch information
iwanders committed Nov 6, 2023
1 parent edfaaed commit e02fe00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/pybind11/detail/smart_holder_poc.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct guarded_delete {

template <typename T, typename std::enable_if<std::is_destructible<T>::value, int>::type = 0>
inline void builtin_delete_if_destructible(void *raw_ptr) {
delete static_cast<T *>(raw_ptr);
std::default_delete<T>{}(static_cast<T *>(raw_ptr));
}

template <typename T, typename std::enable_if<!std::is_destructible<T>::value, int>::type = 0>
Expand Down

0 comments on commit e02fe00

Please sign in to comment.