Commit f2dfdc4
container: count allocate_at_least in heap_vector test allocator (C++23) (#2665)
Summary:
HeapVectorTypes.GrowthPolicy checks CountingAllocator::nAllocations, but the allocator only overrode allocate(). Since C++23, std::vector grows via std::allocator_traits::allocate_at_least, which CountingAllocator inherited from std::allocator and which calls the base allocate(), bypassing the override. On Mac CI (Homebrew LLVM, libc++ in C++23 mode) this left nAllocations at 0 and failed the test; it passed locally under older libc++ / C++20, which still routes growth through allocate().
Override allocate_at_least() to also count, guarded on __cpp_lib_allocate_at_least so C++20 builds are unaffected. Reproduced and verified with -std=c++23 vs c++20.
Pull Request resolved: #2665
Reviewed By: ilvokhin
Differential Revision: D109797758
Pulled By: afrind
fbshipit-source-id: 4fc0be316c1f69fef1881253d9bfb6f6b88be0de1 parent 870e3f2 commit f2dfdc4
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
| |||
0 commit comments