[libcxx-commits] [libcxx] [libc++][test] Fix `MaybePOCCAAllocator` to finally meet the allocator requirements (PR #74960)

Stephan T. Lavavej via libcxx-commits libcxx-commits at lists.llvm.org
Sat Dec 9 18:24:07 PST 2023


https://github.com/StephanTLavavej created https://github.com/llvm/llvm-project/pull/74960

Found while running libc++'s test suite with MSVC's STL.

After @CaseyCarter's [LLVM-D118279](https://reviews.llvm.org/D118279) https://github.com/llvm/llvm-project/commit/c5ba46ea1804dfefb22e6d2bb65ff1636d2cc8cd "\[libcxx\]\[test\] `MaybePOCCAAllocator` should meet the *Cpp17Allocator* requirements" followed by @philnik777's [LLVM-D68365](https://reviews.llvm.org/D68365) https://github.com/llvm/llvm-project/commit/98d3d5b5da66e3cf7807c23a0294280bb796466b "\[libc++\] Implement [P1004R2](https://wg21.link/P1004R2) (`constexpr std::vector`)", one more change is necessary.

MSVC's `constexpr vector` implementation noticed this because we always rebind allocators.

>From 8ef951a8158ed0be80e858295c7d46fe1aeee0f9 Mon Sep 17 00:00:00 2001
From: "Stephan T. Lavavej" <stl at nuwen.net>
Date: Fri, 8 Dec 2023 01:04:24 -0800
Subject: [PATCH] Fix MaybePOCCAAllocator to finally meet the allocator
 requirements.

MSVC's constexpr vector implementation noticed this because we always rebind allocators.
---
 libcxx/test/support/allocators.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/support/allocators.h b/libcxx/test/support/allocators.h
index 2b987ad872783..02436fd9c35ef 100644
--- a/libcxx/test/support/allocators.h
+++ b/libcxx/test/support/allocators.h
@@ -209,7 +209,7 @@ class MaybePOCCAAllocator {
         : id_(id), copy_assigned_into_(copy_assigned_into) {}
 
     template <class U>
-    MaybePOCCAAllocator(const MaybePOCCAAllocator<U, POCCAValue>& that)
+    TEST_CONSTEXPR MaybePOCCAAllocator(const MaybePOCCAAllocator<U, POCCAValue>& that)
         : id_(that.id_), copy_assigned_into_(that.copy_assigned_into_) {}
 
     MaybePOCCAAllocator(const MaybePOCCAAllocator&) = default;



More information about the libcxx-commits mailing list