[Bug libstdc++/92577] Undefined behavior when using std::map with a noexcept allocator

lucas.bader at sap dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 19 11:06:00 GMT 2019


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

--- Comment #3 from Lucas Bader <lucas.bader at sap dot com> ---
Thanks for the clarification. I know that the standard quotes refer to new and
I added them under the impression that an allocator is allowed to return
nullptr from its allocate function. This would make the call to new in
_M_construct_node undefined.

In the allocator requirements defined in the standard (20.5.3.5) it only says
that "allocate may throw an appropriate exception.". This sounds optional to
me, that's why I thought allocate could legally return nullptr.


More information about the Gcc-bugs mailing list