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

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 10 07:24:46 PST 2024


Author: Peng Liu
Date: 2024-12-10T10:24:40-05:00
New Revision: eacdbc269e5f14292222123150a0e4ff0ad6301d

URL: https://github.com/llvm/llvm-project/commit/eacdbc269e5f14292222123150a0e4ff0ad6301d
DIFF: https://github.com/llvm/llvm-project/commit/eacdbc269e5f14292222123150a0e4ff0ad6301d.diff

LOG: [libc++][test] Fix invalid const conversion in limited_allocator (#118189)

This patch fixes a const-qualification on the return type of a method
of `limited_allocator`, which is widely used for testing allocator-aware
containers.

Added: 
    

Modified: 
    libcxx/test/support/test_allocator.h

Removed: 
    


################################################################################
diff  --git a/libcxx/test/support/test_allocator.h b/libcxx/test/support/test_allocator.h
index cf6952fcd788e6..f8b622d7f95209 100644
--- a/libcxx/test/support/test_allocator.h
+++ b/libcxx/test/support/test_allocator.h
@@ -477,7 +477,7 @@ 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(); }
 };
 
 template <class T, class U, std::size_t N>


        


More information about the libcxx-commits mailing list