From ee6e6d3e45af1f7210e144a17f14fb21a7e86588 Mon Sep 17 00:00:00 2001 From: mikt Date: Tue, 30 Jan 2024 03:09:24 +0000 Subject: [PATCH] [PA] Fix InternalAllocator for GCC builds Internal Allocator has a few missing member functions, that are required as a part of named requirement Allocator. https://en.cppreference.com/w/cpp/named_req/Allocator It broke builds on GCC, so adding these to fix. https://crrev.com/c/5196856/comments/0c4bbfd9_6433016b Change-Id: Ifce5f3e47c94c7bb1e298ac4cd7d0d1e4c6de59c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5231905 Commit-Queue: Mikihito Matsuura Reviewed-by: Kalvin Lee Reviewed-by: Takashi Sakamoto Cr-Commit-Position: refs/heads/main@{#1253709} --- .../internal_allocator_forward.h | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/base/allocator/partition_allocator/src/partition_alloc/internal_allocator_forward.h b/base/allocator/partition_allocator/src/partition_alloc/internal_allocator_forward.h index 45fec29f8cc93..b31a145ff6e99 100644 --- a/base/allocator/partition_allocator/src/partition_alloc/internal_allocator_forward.h +++ b/base/allocator/partition_allocator/src/partition_alloc/internal_allocator_forward.h @@ -27,11 +27,24 @@ PartitionRoot& InternalAllocatorRoot(); template class InternalAllocator { public: - // Member types required by allocator completeness requirements. using value_type = T; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - using propagate_on_container_move_assignment = std::true_type; + using is_always_equal = std::true_type; + + InternalAllocator() = default; + + template + InternalAllocator(const InternalAllocator&) {} // NOLINT + + template + InternalAllocator& operator=(const InternalAllocator&) { + return *this; + } + + template + bool operator==(const InternalAllocator&) { + // InternalAllocator can free allocations made by InternalAllocator. + return true; + } value_type* allocate(std::size_t count);