[libcxx-commits] [libcxx] [libc++][test] Fix invalid low-level const conversion in limited_allocator (PR #118189)

Peng Liu via libcxx-commits libcxx-commits at lists.llvm.org
Sat Nov 30 18:40:44 PST 2024


https://github.com/winner245 updated https://github.com/llvm/llvm-project/pull/118189

>From d8aef47c137a660fdee9462c0f28a253e105a06c Mon Sep 17 00:00:00 2001
From: Peng Liu <winner245 at hotmail.com>
Date: Sat, 30 Nov 2024 21:20:59 -0500
Subject: [PATCH] Fix invalid low-level const conversion

---
 libcxx/test/support/test_allocator.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libcxx/test/support/test_allocator.h b/libcxx/test/support/test_allocator.h
index dcd15332ca304f..5c9467b9b628ca 100644
--- a/libcxx/test/support/test_allocator.h
+++ b/libcxx/test/support/test_allocator.h
@@ -467,7 +467,8 @@ class limited_allocator {
   TEST_CONSTEXPR_CXX20 pointer allocate(size_type n) { return handle_->template allocate<T>(n); }
   TEST_CONSTEXPR_CXX20 void deallocate(pointer p, size_type n) { handle_->template deallocate<T>(p, n); }
   TEST_CONSTEXPR size_type max_size() const { return N; }
-  TEST_CONSTEXPR BuffT* getHandle() const { return handle_.get(); }
+  TEST_CONSTEXPR const BuffT* getHandle() const { return handle_.get(); }
+  TEST_CONSTEXPR BuffT* getHandle() { return handle_.get(); }
 };
 
 template <class T, class U, std::size_t N>



More information about the libcxx-commits mailing list