diff --git a/libcxx/test/support/allocators.h b/libcxx/test/support/allocators.h --- a/libcxx/test/support/allocators.h +++ b/libcxx/test/support/allocators.h @@ -189,14 +189,26 @@ class MaybePOCCAAllocator { int id_ = 0; bool* copy_assigned_into_ = nullptr; + + template friend class MaybePOCCAAllocator; + public: typedef std::integral_constant propagate_on_container_copy_assignment; typedef T value_type; + template + struct rebind { + typedef MaybePOCCAAllocator other; + }; + MaybePOCCAAllocator() = default; MaybePOCCAAllocator(int id, bool* copy_assigned_into) : id_(id), copy_assigned_into_(copy_assigned_into) {} + template + MaybePOCCAAllocator(const MaybePOCCAAllocator& that) + : id_(that.id_), copy_assigned_into_(that.copy_assigned_into_) {} + MaybePOCCAAllocator(const MaybePOCCAAllocator&) = default; MaybePOCCAAllocator& operator=(const MaybePOCCAAllocator& a) { @@ -218,12 +230,14 @@ int id() const { return id_; } - friend bool operator==(const MaybePOCCAAllocator& lhs, const MaybePOCCAAllocator& rhs) + template + friend bool operator==(const MaybePOCCAAllocator& lhs, const MaybePOCCAAllocator& rhs) { return lhs.id() == rhs.id(); } - friend bool operator!=(const MaybePOCCAAllocator& lhs, const MaybePOCCAAllocator& rhs) + template + friend bool operator!=(const MaybePOCCAAllocator& lhs, const MaybePOCCAAllocator& rhs) { return !(lhs == rhs); }