From 53fac07a6440d8f1f0375d92856a61f7292d6e92 Mon Sep 17 00:00:00 2001 From: HenrikVDestia Date: Thu, 2 Jan 2025 15:03:47 +0200 Subject: [PATCH] Test CustomAllocator debugging configuration fix. On Windows 2022 "vector" module deconstructor of the `vector` is the following: ```C++ _CONSTEXPR20 ~vector() noexcept { _Tidy(); #if _ITERATOR_DEBUG_LEVEL != 0 auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Delete_plain_internal(_Alproxy, _STD exchange(_Mypair._Myval2._Myproxy, nullptr)); #endif // _ITERATOR_DEBUG_LEVEL != 0 } ``` When debugging configuration is enabled, internals here report an error for NamespacesDerived.Native. A fix is to add Constructor and Copy Constructor to the NamespacesDerived.h `CustomAllocator`. Windows manual seems to want even more to be defined, but I leave it here. https://learn.microsoft.com/en-us/cpp/standard-library/allocators?view=msvc-170 --- tests/dotnet/NamespacesDerived/NamespacesDerived.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/dotnet/NamespacesDerived/NamespacesDerived.h b/tests/dotnet/NamespacesDerived/NamespacesDerived.h index abed58c5..1353d75c 100644 --- a/tests/dotnet/NamespacesDerived/NamespacesDerived.h +++ b/tests/dotnet/NamespacesDerived/NamespacesDerived.h @@ -103,6 +103,10 @@ class CustomAllocator public: typedef T value_type; + // Suppress some windows Debug errors with constructors. + CustomAllocator() noexcept {}; + template CustomAllocator(const CustomAllocator&) noexcept {}; + T* allocate(size_t cnt, const void* = 0) { return 0; } void deallocate(T* p, size_t cnt) {} bool operator==(const CustomAllocator&) { return true; }