From 1a14950a882615395627003dd9170dafcb7cc400 Mon Sep 17 00:00:00 2001 From: coder7695 <235360898+coder7695@users.noreply.github.com> Date: Mon, 27 Oct 2025 11:36:14 +0500 Subject: [PATCH 1/2] resolve windows compile error --- tests/test.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test.cpp b/tests/test.cpp index c499ece1d20..6387933c567 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -775,8 +775,9 @@ void FixedLengthArrayTest() { #endif MyGame::Example::ArrayStruct* ap = new (non_zero_memory) MyGame::Example::ArrayStruct; -#if defined(_MSC_VER) && defined(_DEBUG) -#define new DEBUG_NEW +#if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \ + defined(_MSC_VER) && defined(_DEBUG) + #define new DEBUG_NEW #endif (void)ap; for (size_t i = 0; i < arr_size; ++i) { From 2f908d7fb7db92a4e6de2747bb4f1d6743c72f08 Mon Sep 17 00:00:00 2001 From: coder7695 <235360898+coder7695@users.noreply.github.com> Date: Mon, 27 Oct 2025 11:46:04 +0500 Subject: [PATCH 2/2] add conditional for undef new --- tests/test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test.cpp b/tests/test.cpp index 6387933c567..581fc6743d5 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -770,7 +770,8 @@ void FixedLengthArrayTest() { // set memory chunk of size ArrayStruct to 1's std::memset(static_cast(non_zero_memory), 1, arr_size); // after placement-new it should be all 0's -#if defined(_MSC_VER) && defined(_DEBUG) +#if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \ + defined(_MSC_VER) && defined(_DEBUG) #undef new #endif MyGame::Example::ArrayStruct* ap =