From 590b39d5b77cae520b32fac093ff6d0c22b393d4 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 4 May 2015 23:21:06 +0300 Subject: [PATCH] Avoid new[] debug variant definition for ancient MS VC++ (restore behavior broken in commit 3d784ed) * include/gc_cpp.h (operator new[]): Update comment. * include/gc_cpp.h (operator new[]): Do not define the debug variant for MS VC pre-v7; add comment. Conflicts: include/gc_cpp.h --- include/gc_cpp.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/gc_cpp.h b/include/gc_cpp.h index 9190027e..b0ab2609 100644 --- a/include/gc_cpp.h +++ b/include/gc_cpp.h @@ -281,6 +281,9 @@ inline void* operator new(size_t size, GC_NS_QUALIFY(GCPlacement) gcp, // if we define a multi-argument operator new[]. // There seems to be no way to redirect new in this environment without // including this everywhere. + // Inlining done to avoid mix up of new and delete operators by VC++ 9 (due + // to arbitrary ordering during linking). + # if _MSC_VER > 1020 inline void* operator new[](size_t size) { @@ -314,11 +317,14 @@ inline void* operator new(size_t size, GC_NS_QUALIFY(GCPlacement) gcp, # endif } - inline void* operator new[](size_t size, int nBlockUse, - const char* szFileName, int nLine) - { - return operator new(size, nBlockUse, szFileName, nLine); - } +# if _MSC_VER > 1020 + // This new operator is used by VC++ 7+ in Debug builds: + inline void* operator new[](size_t size, int nBlockUse, + const char* szFileName, int nLine) + { + return operator new(size, nBlockUse, szFileName, nLine); + } +# endif #endif // _MSC_VER -- 2.40.0