about summary refs log tree commit diff
path: root/absl/container/inlined_vector_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/container/inlined_vector_test.cc')
-rw-r--r--absl/container/inlined_vector_test.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/absl/container/inlined_vector_test.cc b/absl/container/inlined_vector_test.cc
index 080ea95665d5..2c9b0d0e039f 100644
--- a/absl/container/inlined_vector_test.cc
+++ b/absl/container/inlined_vector_test.cc
@@ -1754,6 +1754,30 @@ TEST(AllocatorSupportTest, SizeAllocConstructor) {
   }
 }
 
+TEST(InlinedVectorTest, MinimumAllocatorCompilesUsingTraits) {
+  using T = int;
+  using A = std::allocator<T>;
+  using ATraits = absl::allocator_traits<A>;
+
+  struct MinimumAllocator {
+    using value_type = T;
+
+    value_type* allocate(size_t n) {
+      A a;
+      return ATraits::allocate(a, n);
+    }
+
+    void deallocate(value_type* p, size_t n) {
+      A a;
+      ATraits::deallocate(a, p, n);
+    }
+  };
+
+  absl::InlinedVector<T, 1, MinimumAllocator> vec;
+  vec.emplace_back();
+  vec.resize(0);
+}
+
 TEST(InlinedVectorTest, AbslHashValueWorks) {
   using V = absl::InlinedVector<int, 4>;
   std::vector<V> cases;