Work around placement new breakage by wx/msw/msvcrt.h

Including that header breaks any use of placement new, such as the one
in wx/any.h, so we need to explicitly undefine (and then redefine it
back) "new" to make it compile in case wx/msw/msvcrt.h is included
first.
This commit is contained in:
Vadim Zeitlin 2023-01-31 14:45:04 +00:00
parent 93c6551364
commit 6e4d0202ad

View file

@ -205,9 +205,18 @@ public:
static void SetValue(const T& value,
wxAnyValueBuffer& buf)
{
// Use placement new
// Use placement new, taking care to avoid running into problems with
// "new" redefinition in wx/msw/msvcrt.h.
#ifdef WXDEBUG_NEW
#undef new
#endif
void* const place = buf.m_buffer;
::new(place) T(value);
#ifdef WXDEBUG_NEW
#define new WXDEBUG_NEW
#endif
}
static const T& GetValue(const wxAnyValueBuffer& buf)