From 6cee5a8009c6cb1e8eebd23e7109654babb2b585 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 26 Nov 2023 17:06:03 -0800 Subject: [PATCH] Avoid using allocator, which MSVC's STL rejects. This intentionally leaves `ElementPool::get_ptr()` returning `T*`, so there's no externally visible difference. --- .../std/containers/views/mdspan/MinimalElementType.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libcxx/test/std/containers/views/mdspan/MinimalElementType.h b/libcxx/test/std/containers/views/mdspan/MinimalElementType.h index b1fbd6ed944d179..fe7f0e1f2383790 100644 --- a/libcxx/test/std/containers/views/mdspan/MinimalElementType.h +++ b/libcxx/test/std/containers/views/mdspan/MinimalElementType.h @@ -9,7 +9,8 @@ #ifndef TEST_STD_CONTAINERS_VIEWS_MDSPAN_MINIMAL_ELEMENT_TYPE_H #define TEST_STD_CONTAINERS_VIEWS_MDSPAN_MINIMAL_ELEMENT_TYPE_H -#include +#include +#include // Idiosyncratic element type for mdspan // Make sure we don't assume copyable, default constructible, movable etc. @@ -25,7 +26,7 @@ struct MinimalElementType { template struct ElementPool { constexpr ElementPool() { - ptr_ = std::allocator().allocate(N); + ptr_ = std::allocator>().allocate(N); for (int i = 0; i != N; ++i) std::construct_at(ptr_ + i, 42); } @@ -35,11 +36,11 @@ struct ElementPool { constexpr ~ElementPool() { for (int i = 0; i != N; ++i) std::destroy_at(ptr_ + i); - std::allocator().deallocate(ptr_, N); + std::allocator>().deallocate(ptr_, N); } private: - T* ptr_; + std::remove_const_t* ptr_; }; #endif // TEST_STD_CONTAINERS_VIEWS_MDSPAN_MINIMAL_ELEMENT_TYPE_H