Cleanup: Update comment in MEM_freeN<T> about MSVC and triviality check.

This commit is contained in:
Bastien Montagne
2025-02-21 10:37:13 +01:00
parent 718d4ffe9f
commit e0829f9e55

View File

@@ -400,10 +400,12 @@ template<typename T> inline T *MEM_cnew(const char *allocation_name, const T &ot
template<typename T> inline void MEM_freeN(T *ptr)
{
# ifdef _MSC_VER
/* MSVC seems to consider C-style types using the DNA_DEFINE_CXX_METHODS as non-trivial. GCC
* and clang (both on linux, OSX and clang-cl on Windows on Arm) do not.
/* MSVC considers C-style types using the DNA_DEFINE_CXX_METHODS as non-trivial (more
* specifically, non-trivially copyable, likely because the default copy constructors are
* deleted). GCC and clang (both on linux, OSX, and clang-cl on Windows on Arm) do not.
*
* So for now, disable the triviality check on MSVC. */
* So for now, use a more restricted check on MSVC, should still catch most of actual invalid
* cases. */
static_assert(std::is_trivially_destructible_v<T>,
"For non-trivial types, MEM_delete must be used.");
# else