Skip to content

Commit 53fac07

Browse files
committed
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
1 parent 56f1b7c commit 53fac07

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/dotnet/NamespacesDerived/NamespacesDerived.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ class CustomAllocator
103103
public:
104104
typedef T value_type;
105105

106+
// Suppress some windows Debug errors with constructors.
107+
CustomAllocator() noexcept {};
108+
template <class U> CustomAllocator(const CustomAllocator<U>&) noexcept {};
109+
106110
T* allocate(size_t cnt, const void* = 0) { return 0; }
107111
void deallocate(T* p, size_t cnt) {}
108112
bool operator==(const CustomAllocator&) { return true; }

0 commit comments

Comments
 (0)