#undef __glibcxx_want_forward_like
#if !defined(__cpp_lib_generator)
-# if (__cplusplus >= 202100L) && (__glibcxx_coroutine)
+# if (__cplusplus >= 202100L) && (__glibcxx_coroutine && __cpp_sized_deallocation)
# define __glibcxx_generator 202207L
# if defined(__glibcxx_want_all) || defined(__glibcxx_want_generator)
# define __cpp_lib_generator 202207L
#else
# define _GLIBCXX_OPERATOR_NEW ::operator new
# define _GLIBCXX_OPERATOR_DELETE ::operator delete
+#endif
+
+#if __cpp_sized_deallocation
+# define _GLIBCXX_SIZED_DELETE(T, p, n) \
+ _GLIBCXX_OPERATOR_DELETE((p), (n) * sizeof(T))
+#else
+# define _GLIBCXX_SIZED_DELETE(T, p, n) _GLIBCXX_OPERATOR_DELETE(p)
#endif
// Precondition: _M_frames == nullptr && __n != 0
if (_M_capacity)
{
if constexpr (is_same_v<allocator_type, allocator<value_type>>)
- _GLIBCXX_OPERATOR_DELETE (static_cast<void*>(_M_frames),
- _M_capacity * sizeof(value_type));
+ _GLIBCXX_SIZED_DELETE(value_type,
+ static_cast<void*>(_M_frames),
+ _M_capacity);
else
__alloc.deallocate(_M_frames, _M_capacity);
_M_frames = nullptr;
}
}
+#undef _GLIBCXX_SIZED_DELETE
#undef _GLIBCXX_OPERATOR_DELETE
#undef _GLIBCXX_OPERATOR_NEW