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

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Dec 9 18:24:35 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Stephan T. Lavavej (StephanTLavavej)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/74960.diff


1 Files Affected:

- (modified) libcxx/test/support/allocators.h (+1-1) 


``````````diff
diff --git a/libcxx/test/support/allocators.h b/libcxx/test/support/allocators.h
index 2b987ad872783e..02436fd9c35ef1 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;

``````````

</details>


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


More information about the libcxx-commits mailing list