Add conditional check (#8736)

* resolve windows compile error

* add conditional for undef new

---------

Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
This commit is contained in:
coder7695
2025-10-31 19:20:18 +01:00
committed by GitHub
parent 051604aeb5
commit dd77af75b7

View File

@@ -770,13 +770,15 @@ void FixedLengthArrayTest() {
// set memory chunk of size ArrayStruct to 1's
std::memset(static_cast<void*>(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 =
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) {