[gcc r16-8789] libstdc++: fix allocator_traits<>::allocate_at_least

Nathan Myers ncm@gcc.gnu.org
Tue Apr 21 21:00:29 GMT 2026


https://gcc.gnu.org/g:83e758acdb8fc24acfbbcc5696d052ac0a565d72

commit r16-8789-g83e758acdb8fc24acfbbcc5696d052ac0a565d72
Author: Nathan Myers <ncm@cantrip.org>
Date:   Mon Apr 13 14:48:22 2026 -0400

    libstdc++: fix allocator_traits<>::allocate_at_least
    
    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.

Diff:
---
 libstdc++-v3/include/bits/alloc_traits.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h
index 2be8ed561d41..e4e0f1608dec 100644
--- a/libstdc++-v3/include/bits/alloc_traits.h
+++ b/libstdc++-v3/include/bits/alloc_traits.h
@@ -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


More information about the Libstdc++-cvs mailing list