[Bug libstdc++/64135] Allocator base classes should use reserved names

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 9 23:24:14 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64135

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:fe9571a35db53e5203326f854f73e432691d67f6

commit r12-5873-gfe9571a35db53e5203326f854f73e432691d67f6
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Dec 1 17:56:23 2021 +0000

    libstdc++: Fix non-reserved name in std::allocator base class [PR64135]

    The possible base classes of std::allocator are new_allocator and
    malloc_allocator, which both cause a non-reserved name to be declared in
    every program that includes the definition of std::allocator. This is
    non-conforming.

    This change replaces __gnu_cxx::new_allocator with std::__new_allocator
    which is identical except for using a reserved name. The non-standard
    extension __gnu_cxx::new_allocator is preserved as a thin wrapper over
    std::__new_allocator. There is no problem with the extension using a
    non-reserved name now that it's not included by default in other
    headers.

    The same change could be done to __gnu_cxx::malloc_allocator but as it's
    not the default configuration it can wait.

    libstdc++-v3/ChangeLog:

            PR libstdc++/64135
            * config/allocator/new_allocator_base.h: Include
            <bits/new_allocator.h> instead of <ext/new_allocator.h>.
            (__allocator_base): Use std::__new_allocator instead of
            __gnu_cxx::new_allocator.
            * doc/xml/manual/allocator.xml: Document new default base class
            for std::allocator.
            * doc/xml/manual/evolution.xml: Likewise.
            * doc/html/*: Regenerate.
            * include/Makefile.am: Add bits/new_allocator.h.
            * include/Makefile.in: Regenerate.
            * include/experimental/memory_resource (new_delete_resource):
            Use std::__new_allocator instead of __gnu_cxx::new_allocator.
            * include/ext/new_allocator.h (new_allocator): Derive from
            std::__new_allocator. Move implementation to ...
            * include/bits/new_allocator.h: New file.
            * testsuite/20_util/allocator/64135.cc: New test.


More information about the Gcc-bugs mailing list