]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: fix allocator_traits<>::allocate_at_least
authorNathan Myers <ncm@cantrip.org>
Mon, 13 Apr 2026 18:48:22 +0000 (14:48 -0400)
committerNathan Myers <ncm@cantrip.org>
Tue, 21 Apr 2026 20:53:57 +0000 (16:53 -0400)
allocator_traits<>::allocate_at_least has taken its allocator
by value, incorrectly. This patch makes it take its allocator
by reference, as specified.

libstdc++-v3/ChangeLog:
* include/bits/alloc_traits.h (allocate_at_least):
Take allocator argument by reference, per Standard.

libstdc++-v3/include/bits/alloc_traits.h

index 2be8ed561d416c124b7c40a5a34b2623adfa648a..e4e0f1608deccd00fc828d4ed51e5c36561a3812 100644 (file)
@@ -670,7 +670,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        *  Returns `a.allocate_at_least(n)`.
       */
       [[nodiscard]] static constexpr auto
-      allocate_at_least(allocator_type __a, size_type __n)
+      allocate_at_least(allocator_type& __a, size_type __n)
        -> allocation_result<pointer, size_type>
       { return __a.allocate_at_least(__n); }
 #endif