diff --git a/libraries/lib-utility/MemoryX.cpp b/libraries/lib-utility/MemoryX.cpp index 51888e6ab..d4e7113d6 100644 --- a/libraries/lib-utility/MemoryX.cpp +++ b/libraries/lib-utility/MemoryX.cpp @@ -14,8 +14,6 @@ UTILITY_API void lib_utility_dummy_symbol() {} -#ifdef __APPLE__ - constexpr auto sizeof_align_val = sizeof(std::align_val_t); void *NonInterferingBase::operator new(std::size_t count, std::align_val_t al) @@ -54,5 +52,3 @@ void NonInterferingBase::operator delete(void *ptr, std::align_val_t al) // Call through to default operator ::operator delete(p); } - -#endif diff --git a/libraries/lib-utility/MemoryX.h b/libraries/lib-utility/MemoryX.h index aee9a956b..ad84fbd56 100644 --- a/libraries/lib-utility/MemoryX.h +++ b/libraries/lib-utility/MemoryX.h @@ -594,10 +594,21 @@ struct UTILITY_API alignas( 64 /* ? */ #endif ) + NonInterferingBase { -#ifdef __APPLE__ static void *operator new(std::size_t count, std::align_val_t al); static void operator delete(void *ptr, std::align_val_t al); + +#if defined (_MSC_VER) && defined(_DEBUG) + // Versions that work in the presence of the DEBUG_NEW macro. + // Ignore the arguments supplied by the macro and forward to the + // other overloads. + static void *operator new( + std::size_t count, std::align_val_t al, int, const char *, int) + { return operator new(count, al); } + static void operator delete( + void *ptr, std::align_val_t al, int, const char *, int) + { return operator delete(ptr, al); } #endif };