From e0829f9e5504910a1839073355b03a89fccd1660 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 21 Feb 2025 10:37:13 +0100 Subject: [PATCH] Cleanup: Update comment in `MEM_freeN` about MSVC and triviality check. --- intern/guardedalloc/MEM_guardedalloc.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 92e8fe17032..295e511a228 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -400,10 +400,12 @@ template inline T *MEM_cnew(const char *allocation_name, const T &ot template 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, "For non-trivial types, MEM_delete must be used."); # else