Fix ::operator new / delete[] mismatch — use ::operator delete to match

This commit is contained in:
J. Nick Koston
2026-03-27 15:54:40 -10:00
parent fe8e7c134c
commit f48eff29c3
+3 -3
View File
@@ -420,7 +420,7 @@ template<typename T, size_t MAX_CAPACITY = std::numeric_limits<uint16_t>::max()>
if constexpr (std::is_trivially_copyable<T>::value && std::is_trivially_default_constructible<T>::value) {
::operator delete(this->data_);
} else {
delete[] this->data_;
::operator delete(this->data_);
}
}
@@ -1804,7 +1804,7 @@ template<typename... Ts> class CallbackManager<void(Ts...)> {
public:
CallbackManager() = default;
~CallbackManager() { delete[] this->data_; }
~CallbackManager() { ::operator delete(this->data_); }
// Non-copyable (would alias data_), movable (for std::map support)
CallbackManager(const CallbackManager &) = delete;
@@ -1817,7 +1817,7 @@ template<typename... Ts> class CallbackManager<void(Ts...)> {
}
CallbackManager &operator=(CallbackManager &&other) noexcept {
if (this != &other) {
delete[] this->data_;
::operator delete(this->data_);
this->data_ = other.data_;
this->size_ = other.size_;
this->capacity_ = other.capacity_;