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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-10-07
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  The specification for allocator::max_size() to return SIZE_MAX /
sizeof (value_type) is worse than useless.

At the same time, since the call malloc(SIZE_MAX) is guaranteed to fail, GCC
could fold it to zero.  It would also have to set errno to ENOMEM but that
would be useful in other contexts, such as to fix pr87096.  The same call to
operator new could be either replaced by throwing an exception or simply folded
to zero if the call were to the nothrow new.  That would avoid the warning
(calling the ordinary new also triggers the warning but calling the nothrow new
doesn't, even though the call is still emitted).

Reply via email to